@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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as DecisionModel from 'effect/ai/DecisionModel';
|
|
2
|
+
import * as Architecture from './architecture.ts';
|
|
3
|
+
import type * as Score from './score.ts';
|
|
4
|
+
export declare const RULES: readonly Architecture.Rule[];
|
|
5
|
+
/** {@link RULES} for a judge shown the page as an image (`Architecture.Subject.images`) instead of `layout`. */
|
|
6
|
+
export declare const IMAGE_RULES: readonly Architecture.Rule[];
|
|
7
|
+
/**
|
|
8
|
+
* Every aesthetic rule as a score from one `DecisionModel` call. Without `layout` or an image of the
|
|
9
|
+
* page there is nothing to judge, so each rule reports an error rather than a guess.
|
|
10
|
+
*/
|
|
11
|
+
export declare const judge: (rules?: readonly Architecture.Rule[]) => Score.Batch<Architecture.Subject, DecisionModel.DecisionModel>;
|
|
12
|
+
//# sourceMappingURL=aesthetics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aesthetics.d.ts","sourceRoot":"","sources":["../../../src/aesthetics.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,aAAa,MAAM,yBAAyB,CAAC;AAG9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAmBzC,eAAO,MAAM,KAAK,EAAE,SAAS,YAAY,CAAC,IAAI,EA0F7C,CAAC;AAEF,gHAAgH;AAChH,eAAO,MAAM,WAAW,EAAE,SAAS,YAAY,CAAC,IAAI,EAGjD,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,KAAK,WACT,SAAS,YAAY,CAAC,IAAI,EAAE,KAClC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAS/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aesthetics.test.d.ts","sourceRoot":"","sources":["../../../src/aesthetics.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type * as DecisionModel from 'effect/ai/DecisionModel';
|
|
2
|
+
import * as Architecture from './architecture.ts';
|
|
3
|
+
import * as Diagnostics from './diagnostics.ts';
|
|
4
|
+
import * as Objective from './objective.ts';
|
|
5
|
+
import * as Rules from './rules.ts';
|
|
6
|
+
import type * as Scene from './scene.ts';
|
|
7
|
+
import type * as Score from './score.ts';
|
|
8
|
+
import * as View from './view.ts';
|
|
9
|
+
type Point = Scene.Point;
|
|
10
|
+
/** Everything an evaluator reads: the scene, its geometry and its defect report, computed once. */
|
|
11
|
+
export type Subject = {
|
|
12
|
+
readonly objects: readonly Scene.WorldObject[];
|
|
13
|
+
readonly drawing: View.Drawing;
|
|
14
|
+
readonly report: Diagnostics.Report;
|
|
15
|
+
/** Connectors as a reader traces them (a bus once per spoke), each with the boxes at its ends. */
|
|
16
|
+
readonly edges: readonly Edge[];
|
|
17
|
+
};
|
|
18
|
+
export type Edge = {
|
|
19
|
+
readonly points: readonly Point[];
|
|
20
|
+
readonly bends: number;
|
|
21
|
+
readonly from?: View.Box;
|
|
22
|
+
readonly to?: View.Box;
|
|
23
|
+
readonly style?: View.Path['style'];
|
|
24
|
+
};
|
|
25
|
+
export type Measure = {
|
|
26
|
+
readonly score: number;
|
|
27
|
+
readonly detail: string;
|
|
28
|
+
};
|
|
29
|
+
export type Evaluator = (subject: Subject) => Measure;
|
|
30
|
+
/** Code evaluators, keyed by rule id; every `code` and `both` rule in the library has one. */
|
|
31
|
+
export declare const EVALUATORS: Readonly<Record<string, Evaluator>>;
|
|
32
|
+
/** Measures every code-evaluated rule of a scene. */
|
|
33
|
+
export declare const measure: (objects: readonly Scene.WorldObject[], rules?: readonly Rules.DiagramRule[]) => (Rules.DiagramRule & Measure)[];
|
|
34
|
+
/** The weighted mean of rule scores: one number for comparing drawings of the same diagram. */
|
|
35
|
+
export declare const overall: (scores: readonly {
|
|
36
|
+
weight: number;
|
|
37
|
+
score: number;
|
|
38
|
+
}[]) => number;
|
|
39
|
+
/** The library's `vision` and `both` rules as questions for a judge shown the rendered page. */
|
|
40
|
+
export declare const visionRules: (rules?: readonly Rules.DiagramRule[]) => readonly Architecture.Rule[];
|
|
41
|
+
/** The vision rules as one batched judge over the rendered page; a failed call scores every rule as an error. */
|
|
42
|
+
export declare const judge: (rules?: readonly Rules.DiagramRule[]) => Score.Batch<Architecture.Subject, DecisionModel.DecisionModel>;
|
|
43
|
+
/** The code-evaluated rules as scorers over a scene, for `Score.evaluate` beside the judge. */
|
|
44
|
+
export declare const scorers: (rules?: readonly Rules.DiagramRule[]) => Score.Scorer<readonly Scene.WorldObject[]>[];
|
|
45
|
+
/**
|
|
46
|
+
* A layout objective that adds the library's appeal to `base`: its hard constraints and costs stay, and
|
|
47
|
+
* every point of appeal a candidate lacks costs `weight` (a crossing costs 3), so the engine prefers the
|
|
48
|
+
* candidate a reader would. Appeal is measured over the code-evaluated rules only.
|
|
49
|
+
*/
|
|
50
|
+
export declare const objective: (base?: Objective.Objective, { weight, rules }?: {
|
|
51
|
+
weight?: number;
|
|
52
|
+
rules?: readonly Rules.DiagramRule[];
|
|
53
|
+
}) => Objective.Objective;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=appeal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appeal.d.ts","sourceRoot":"","sources":["../../../src/appeal.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,KAAK,aAAa,MAAM,yBAAyB,CAAC;AAG9D,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,WAAW,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,KAAK,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KAClC,CAAC,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC,EAY/B,CAAC;AAEF,+FAA+F;AAC/F,eAAO,MAAM,OAAO,WAAY,SAAS;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,KAAG,MAG9E,CAAC;AAOF,gGAAgG;AAChG,eAAO,MAAM,WAAW,WAAW,SAAS,KAAK,CAAC,WAAW,EAAE,KAAiB,SAAS,YAAY,CAAC,IAAI,EAavG,CAAC;AAEJ,iHAAiH;AACjH,eAAO,MAAM,KAAK,WACT,SAAS,KAAK,CAAC,WAAW,EAAE,KAClC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAAqD,CAAC;AAEtH,+FAA+F;AAC/F,eAAO,MAAM,OAAO,WACX,SAAS,KAAK,CAAC,WAAW,EAAE,KAClC,KAAK,CAAC,MAAM,CAAC,SAAS,KAAK,CAAC,WAAW,EAAE,CAAC,EAgB1C,CAAC;AAEJ;;;;GAIG;AACH,eAAO,MAAM,SAAS,UACd,SAAS,CAAC,SAAS,sBACa;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,EAAE,CAAA;CAAE,KAC9F,SAAS,CAAC,SAWX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appeal.test.d.ts","sourceRoot":"","sources":["../../../src/appeal.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import * as Decision from 'effect/ai/Decision';
|
|
2
|
+
import * as DecisionModel from 'effect/ai/DecisionModel';
|
|
3
|
+
import * as Schema from 'effect/Schema';
|
|
4
|
+
import type * as Mermaid from './mermaid.ts';
|
|
5
|
+
import type * as Score from './score.ts';
|
|
6
|
+
/** What a diagram says, plus optionally how it is drawn: the input every rule is judged against. */
|
|
7
|
+
export declare const Content: Schema.Struct<{
|
|
8
|
+
readonly title: Schema.optional<Schema.String>;
|
|
9
|
+
readonly layout: Schema.optional<Schema.String>;
|
|
10
|
+
readonly groups: Schema.$Array<Schema.Struct<{
|
|
11
|
+
readonly id: Schema.String;
|
|
12
|
+
readonly label: Schema.String;
|
|
13
|
+
}>>;
|
|
14
|
+
readonly nodes: Schema.$Array<Schema.Struct<{
|
|
15
|
+
readonly id: Schema.String;
|
|
16
|
+
readonly label: Schema.String;
|
|
17
|
+
readonly group: Schema.optional<Schema.String>;
|
|
18
|
+
}>>;
|
|
19
|
+
readonly edges: Schema.$Array<Schema.Struct<{
|
|
20
|
+
readonly from: Schema.String;
|
|
21
|
+
readonly to: Schema.String;
|
|
22
|
+
readonly label: Schema.optional<Schema.String>;
|
|
23
|
+
readonly kind: Schema.optional<Schema.String>;
|
|
24
|
+
}>>;
|
|
25
|
+
}>;
|
|
26
|
+
export type Content = Schema.Schema.Type<typeof Content>;
|
|
27
|
+
/** The content of a parsed mermaid graph, with an optional caption and text rendering of its layout. */
|
|
28
|
+
export declare const contentOf: (graph: Mermaid.MermaidGraph, { title, layout }?: {
|
|
29
|
+
title?: string;
|
|
30
|
+
layout?: string;
|
|
31
|
+
}) => Content;
|
|
32
|
+
export type Rule = {
|
|
33
|
+
/** Kebab-case, as the review rule it adapts is named. */
|
|
34
|
+
id: string;
|
|
35
|
+
/** Decision key: System One names questions by identifier. */
|
|
36
|
+
key: string;
|
|
37
|
+
description: string;
|
|
38
|
+
/** The question, phrased so `true` means the diagram follows the rule. */
|
|
39
|
+
instructions: string;
|
|
40
|
+
criteria: {
|
|
41
|
+
false: string;
|
|
42
|
+
true: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* The first batch of `architecture-rules`' recommended rules that a diagram can show, plus the
|
|
47
|
+
* bounded-state pair `non-negotiables.mdl` already enforces on code.
|
|
48
|
+
*/
|
|
49
|
+
export declare const RULES: readonly Rule[];
|
|
50
|
+
/** The decision definition for a set of rules: one probability per rule, answered in one call. */
|
|
51
|
+
export declare const definition: (rules?: readonly Rule[]) => Decision.Definition<Schema.Struct<{
|
|
52
|
+
readonly title: Schema.optional<Schema.String>;
|
|
53
|
+
readonly layout: Schema.optional<Schema.String>;
|
|
54
|
+
readonly groups: Schema.$Array<Schema.Struct<{
|
|
55
|
+
readonly id: Schema.String;
|
|
56
|
+
readonly label: Schema.String;
|
|
57
|
+
}>>;
|
|
58
|
+
readonly nodes: Schema.$Array<Schema.Struct<{
|
|
59
|
+
readonly id: Schema.String;
|
|
60
|
+
readonly label: Schema.String;
|
|
61
|
+
readonly group: Schema.optional<Schema.String>;
|
|
62
|
+
}>>;
|
|
63
|
+
readonly edges: Schema.$Array<Schema.Struct<{
|
|
64
|
+
readonly from: Schema.String;
|
|
65
|
+
readonly to: Schema.String;
|
|
66
|
+
readonly label: Schema.optional<Schema.String>;
|
|
67
|
+
readonly kind: Schema.optional<Schema.String>;
|
|
68
|
+
}>>;
|
|
69
|
+
}>, {
|
|
70
|
+
[k: string]: Decision.Probability;
|
|
71
|
+
}>;
|
|
72
|
+
/**
|
|
73
|
+
* What a judge is shown: the diagram's content, and optionally the rendered page as images for a
|
|
74
|
+
* model that reads them (one that does not fails the call, which scores every rule as an error).
|
|
75
|
+
*/
|
|
76
|
+
export type Subject = {
|
|
77
|
+
readonly content: Content;
|
|
78
|
+
readonly images?: readonly DecisionModel.Image[];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Every rule as a score, from one `DecisionModel` call: the probability that the diagram follows the
|
|
82
|
+
* rule. A failed call scores every rule as an error rather than as 0, so an outage never reads as a
|
|
83
|
+
* bad diagram. `kind` labels the scores, so another rule set (e.g. `Aesthetics`) can share the judge.
|
|
84
|
+
*/
|
|
85
|
+
export declare const judge: (rules?: readonly Rule[], kind?: Score.Kind) => Score.Batch<Subject, DecisionModel.DecisionModel>;
|
|
86
|
+
//# sourceMappingURL=architecture.d.ts.map
|
|
@@ -0,0 +1 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,EAAE,SAAS,aAAa,CAAC,KAAK,EAAE,CAAA;CAAE,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,KAAK,WACT,SAAS,IAAI,EAAE,SAChB,KAAK,CAAC,IAAI,KACf,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAmBlD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"architecture.test.d.ts","sourceRoot":"","sources":["../../../src/architecture.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type * as Scene from './scene.ts';
|
|
2
|
+
export type Geometry = {
|
|
3
|
+
/** Box size, shared by every node. */
|
|
4
|
+
cell: {
|
|
5
|
+
w: number;
|
|
6
|
+
h: number;
|
|
7
|
+
};
|
|
8
|
+
/** Lattice pitch; every move is a whole number of pitches. */
|
|
9
|
+
pitch: {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
/** Inset of a frame around its members, and the label band above them. */
|
|
14
|
+
framePad: number;
|
|
15
|
+
frameLabel: number;
|
|
16
|
+
/** Clear space a frame keeps from other frames and from boxes outside it. */
|
|
17
|
+
frameGap: number;
|
|
18
|
+
};
|
|
19
|
+
export type Graph = {
|
|
20
|
+
nodes: readonly string[];
|
|
21
|
+
groups: readonly {
|
|
22
|
+
id: string;
|
|
23
|
+
children: readonly string[];
|
|
24
|
+
}[];
|
|
25
|
+
edges: readonly {
|
|
26
|
+
from: string;
|
|
27
|
+
to: string;
|
|
28
|
+
}[];
|
|
29
|
+
};
|
|
30
|
+
type Points = Map<string, Scene.Point>;
|
|
31
|
+
/**
|
|
32
|
+
* Compacts a lattice placement. Units are every package (moved rigidly) and every box (moved
|
|
33
|
+
* within or outside its package); a move is kept only when it lowers the cost — connector length
|
|
34
|
+
* plus bends plus the drawing's width and height, all in lattice units — and introduces no
|
|
35
|
+
* violation of the placement's invariants.
|
|
36
|
+
*/
|
|
37
|
+
export declare const compact: (graph: Graph, positions: ReadonlyMap<string, Scene.Point>, geometry: Geometry) => Points;
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=compact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact.d.ts","sourceRoot":"","sources":["../../../src/compact.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,KAAK,MAAM,YAAY,CAAC;AAGzC,MAAM,MAAM,QAAQ,GAAG;IACrB,sCAAsC;IACtC,IAAI,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/B,8DAA8D;IAC9D,KAAK,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChC,0EAA0E;IAC1E,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,EAAE,CAAC;IAC/D,KAAK,EAAE,SAAS;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAChD,CAAC;AAWF,KAAK,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;AAgBvC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,UAAW,KAAK,aAAa,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,YAAY,QAAQ,KAAG,MAyJvG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compact.test.d.ts","sourceRoot":"","sources":["../../../src/compact.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Schema from 'effect/Schema';
|
|
2
|
-
import
|
|
2
|
+
import * as Scene from './scene.ts';
|
|
3
3
|
export declare const Severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
4
4
|
export type Severity = Schema.Schema.Type<typeof Severity>;
|
|
5
5
|
/**
|
|
@@ -7,12 +7,12 @@ export type Severity = Schema.Schema.Type<typeof Severity>;
|
|
|
7
7
|
* `warning` codes are quality metrics that trend rather than pass/fail; they are golden-filed so
|
|
8
8
|
* a layout change reads as a reviewable diff instead of a threshold argument.
|
|
9
9
|
*/
|
|
10
|
-
export declare const Code: Schema.Literals<readonly ["node-overlap", "route-through-node", "label-overflow", "edge-crossing", "excessive-bends"]>;
|
|
10
|
+
export declare const Code: Schema.Literals<readonly ["node-overlap", "route-through-node", "label-overflow", "edge-crossing", "excessive-bends", "text-overlap", "edge-overlap"]>;
|
|
11
11
|
export type Code = Schema.Schema.Type<typeof Code>;
|
|
12
12
|
export declare const SEVERITY: Record<Code, Severity>;
|
|
13
13
|
/** A schema so operations can return diagnostics to the agent — the repair loop. */
|
|
14
14
|
export declare const Diagnostic: Schema.Struct<{
|
|
15
|
-
readonly code: Schema.Literals<readonly ["node-overlap", "route-through-node", "label-overflow", "edge-crossing", "excessive-bends"]>;
|
|
15
|
+
readonly code: Schema.Literals<readonly ["node-overlap", "route-through-node", "label-overflow", "edge-crossing", "excessive-bends", "text-overlap", "edge-overlap"]>;
|
|
16
16
|
readonly severity: Schema.Literals<readonly ["error", "warning"]>;
|
|
17
17
|
readonly message: Schema.String;
|
|
18
18
|
readonly refs: Schema.$Array<Schema.String>;
|
|
@@ -21,10 +21,15 @@ export type Diagnostic = Schema.Schema.Type<typeof Diagnostic>;
|
|
|
21
21
|
/** Aggregate counts; the soft ones are the score a layout change is reviewed against. */
|
|
22
22
|
export type Metrics = {
|
|
23
23
|
nodes: number;
|
|
24
|
+
/** Connectors as a reader traces them, source to target: a bus counts once per spoke. */
|
|
24
25
|
connectors: number;
|
|
25
26
|
overlaps: number;
|
|
26
27
|
routesThroughNodes: number;
|
|
27
28
|
labelOverflows: number;
|
|
29
|
+
/** Free text (edge and frame labels) overlapping another label or a box it does not belong to. */
|
|
30
|
+
textOverlaps: number;
|
|
31
|
+
/** Connector pairs that run along the same line for part of their length, so a reader cannot tell them apart. */
|
|
32
|
+
edgeOverlaps: number;
|
|
28
33
|
crossings: number;
|
|
29
34
|
bends: number;
|
|
30
35
|
/** Total connector length in scene units; long edges are hard to follow. */
|
|
@@ -46,6 +51,67 @@ export type Options = {
|
|
|
46
51
|
/** Bends per connector above which `excessive-bends` is reported (default 3). */
|
|
47
52
|
maxBends?: number;
|
|
48
53
|
};
|
|
54
|
+
type Point = Scene.Point;
|
|
55
|
+
type Rect = {
|
|
56
|
+
x: number;
|
|
57
|
+
y: number;
|
|
58
|
+
w: number;
|
|
59
|
+
h: number;
|
|
60
|
+
};
|
|
61
|
+
export type Label = {
|
|
62
|
+
ref: string;
|
|
63
|
+
rect: Rect;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Absolute extents of free text elements, estimated from the font metrics as the renderers draw it:
|
|
67
|
+
* `x, y` is the top-left, one line per `\n`.
|
|
68
|
+
*/
|
|
69
|
+
export declare const labels: (objects: readonly Scene.WorldObject[]) => Label[];
|
|
70
|
+
/** Absolute rects of every shape an arrow can bind to, keyed `objectId/elementId` as `Scene.resolveRef` spells them. */
|
|
71
|
+
export declare const bindTargets: (objects: readonly Scene.WorldObject[]) => Map<string, Rect>;
|
|
72
|
+
/**
|
|
73
|
+
* The polyline drawn for an arrow, in absolute coordinates: a bound end sits where the line between the
|
|
74
|
+
* two centres leaves its shape, and an arrow bound to one shape at both ends loops off its top-right
|
|
75
|
+
* corner. Undefined when an end resolves to nothing. Renderers draw through this so the picture and the
|
|
76
|
+
* measurement cannot disagree.
|
|
77
|
+
*/
|
|
78
|
+
export declare const arrowPoints: (object: Scene.WorldObject, arrow: Scene.Arrow, targets: ReadonlyMap<string, Rect>) => Point[] | undefined;
|
|
79
|
+
/** A connector as a reader traces it, from one shape to another; `ref` names the piece at its far end. */
|
|
80
|
+
export type Route = {
|
|
81
|
+
ref: string;
|
|
82
|
+
points: Point[];
|
|
83
|
+
/** Turns a reader follows; a turn where pieces of a bus meet is the bus's shape, not a bend. */
|
|
84
|
+
bends: number;
|
|
85
|
+
};
|
|
86
|
+
/** Every connector's routes, as a reader traces them; a bus contributes one per spoke. */
|
|
87
|
+
export declare const routes: (objects: readonly Scene.WorldObject[]) => Route[];
|
|
88
|
+
/** Box label type as the SVG renderer sets it, per weight: font size and line advance in scene units. */
|
|
89
|
+
export declare const LABEL_TYPE: Record<Scene.Weight, {
|
|
90
|
+
size: number;
|
|
91
|
+
lineH: number;
|
|
92
|
+
}>;
|
|
93
|
+
/** Average glyph advance over font size for a UI sans, for wrap estimates. */
|
|
94
|
+
export declare const CHAR_EM = 0.6;
|
|
95
|
+
/** Room kept between a box label and the box's sides, and its top and bottom. */
|
|
96
|
+
export declare const LABEL_INSET: {
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
};
|
|
100
|
+
export type LabelLayout = {
|
|
101
|
+
lines: string[];
|
|
102
|
+
size: number;
|
|
103
|
+
lineH: number;
|
|
104
|
+
/** The label does not show whole: it was ellipsized, or even one line is taller than the box. */
|
|
105
|
+
overflow: boolean;
|
|
106
|
+
};
|
|
107
|
+
/**
|
|
108
|
+
* How the SVG renderer sets a box label: wrapped to the box width, shrunk a little if it still does not
|
|
109
|
+
* fit the height, and ellipsized at the smallest size, so text never spills out of its box.
|
|
110
|
+
*/
|
|
111
|
+
export declare const layoutLabel: (text: string, weight: Scene.Weight, { w, h }: {
|
|
112
|
+
w: number;
|
|
113
|
+
h: number;
|
|
114
|
+
}) => LabelLayout;
|
|
49
115
|
/**
|
|
50
116
|
* Analyzes an emitted scene for layout defects and quality metrics. Pure: the same scene always
|
|
51
117
|
* yields the same report, so the soft metrics can be golden-filed and the hard codes asserted.
|
|
@@ -53,4 +119,5 @@ export type Options = {
|
|
|
53
119
|
export declare const analyze: (objects: readonly Scene.WorldObject[], { maxBends }?: Options) => Report;
|
|
54
120
|
/** Errors only — the set that gates CI and that an agent must fix before the diagram is usable. */
|
|
55
121
|
export declare const errors: (report: Report) => readonly Diagnostic[];
|
|
122
|
+
export {};
|
|
56
123
|
//# sourceMappingURL=diagnostics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/diagnostics.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,KAAK,
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../../src/diagnostics.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AAEpC,eAAO,MAAM,QAAQ,gDAAwC,CAAC;AAC9D,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,IAAI,wJAQf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnD,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,CAQ3C,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,UAAU;;;;;EAOrB,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,UAAU,CAAC,CAAC;AAE/D,yFAAyF;AACzF,MAAM,MAAM,OAAO,GAAG;IACpB,KAAK,EAAE,MA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8M/F,CAAC;AAEF,mGAAmG;AACnG,eAAO,MAAM,MAAM,WAAY,MAAM,KAAG,SAAS,UAAU,EACQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../src/dsl/cli.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import * as SemanticEngine from '../semantic-engine.ts';
|
|
3
|
+
import { type ParseResult } from './parse.ts';
|
|
4
|
+
/** Options for {@link compile}. */
|
|
5
|
+
export type CompileOptions = Pick<SemanticEngine.SolveOptions, 'emitCandidate'>;
|
|
6
|
+
/**
|
|
7
|
+
* Reads a document and lays out its semantic statements with the full search, which also tries the
|
|
8
|
+
* mermaid engine's placements when nothing was hinted. Asynchronous only because that engine's ELK
|
|
9
|
+
* is; a document of scene statements alone reads exactly as {@link parse} reads it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const compile: (text: string, options?: CompileOptions) => Effect.Effect<ParseResult>;
|
|
12
|
+
//# sourceMappingURL=compile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../../src/dsl/compile.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,YAAY,CAAC;AAEhE,mCAAmC;AACnC,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AAEhF;;;;GAIG;AACH,eAAO,MAAM,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,KAAK,MAAM,CAAC,MAAM,CAAC,WAAW,CAU1F,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import * as Effect from 'effect/Effect';
|
|
2
|
+
import type * as Scene from '../scene.ts';
|
|
3
|
+
/** A source language that can be turned into DSL text. */
|
|
4
|
+
export type Source = {
|
|
5
|
+
id: string;
|
|
6
|
+
description: string;
|
|
7
|
+
/** True when a source string looks like this language, for `convert` to pick without being told. */
|
|
8
|
+
detect: (source: string) => boolean;
|
|
9
|
+
compile: (source: string) => Effect.Effect<readonly Scene.Command[]>;
|
|
10
|
+
};
|
|
11
|
+
/** Mermaid `classDiagram`, laid out synchronously by the UML engine. */
|
|
12
|
+
export declare const umlSource: Source;
|
|
13
|
+
/**
|
|
14
|
+
* Mermaid `flowchart`, laid out by the ELK-backed engine. ELK is promise-based, so the platform
|
|
15
|
+
* boundary sits here rather than leaking a Promise into the rest of the pipeline.
|
|
16
|
+
*/
|
|
17
|
+
export declare const mermaidSource: Source;
|
|
18
|
+
/** Mermaid flowchart without the ELK pass — the simple layered placement in `mermaid.ts`. */
|
|
19
|
+
export declare const mermaidLayeredSource: Source;
|
|
20
|
+
export declare const SOURCES: readonly Source[];
|
|
21
|
+
/** The language a source string is written in, or undefined when nothing claims it. */
|
|
22
|
+
export declare const detect: (source: string) => Source | undefined;
|
|
23
|
+
declare const UnknownSourceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
24
|
+
readonly _tag: "DiagramUnknownSource";
|
|
25
|
+
} & Readonly<A>;
|
|
26
|
+
/** Tagged so the failure channel stays discriminated rather than collapsing into bare `Error`. */
|
|
27
|
+
export declare class UnknownSourceError extends UnknownSourceError_base<{
|
|
28
|
+
id: string;
|
|
29
|
+
}> {
|
|
30
|
+
get message(): string;
|
|
31
|
+
}
|
|
32
|
+
declare const UndetectedSourceError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
33
|
+
readonly _tag: "DiagramUndetectedSource";
|
|
34
|
+
} & Readonly<A>;
|
|
35
|
+
export declare class UndetectedSourceError extends UndetectedSourceError_base<{}> {
|
|
36
|
+
get message(): string;
|
|
37
|
+
}
|
|
38
|
+
export type ConvertOptions = {
|
|
39
|
+
/** Force a language instead of detecting one. */
|
|
40
|
+
source?: string;
|
|
41
|
+
};
|
|
42
|
+
/** Compiles `text` through its dialect and prints the result as DSL text. */
|
|
43
|
+
export declare const convert: (text: string, { source }?: ConvertOptions) => Effect.Effect<string, UnknownSourceError | UndetectedSourceError>;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.d.ts","sourceRoot":"","sources":["../../../../src/dsl/convert.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAIxC,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAI1C,0DAA0D;AAC1D,MAAM,MAAM,MAAM,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,oGAAoG;IACpG,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACpC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,SAAS,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;CACtE,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,SAAS,EAAE,MAKvB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAK3B,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,oBAAoB,EAAE,MAKlC,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,SAAS,MAAM,EAAqD,CAAC;AAE3F,uFAAuF;AACvF,eAAO,MAAM,MAAM,WAAY,MAAM,KAAG,MAAM,GAAG,SAAyD,CAAC;;;;AAI3G,kGAAkG;AAClG,qBAAa,kBAAmB,SAAQ,wBAAyC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;IAC9F,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;;;;AAED,qBAAa,qBAAsB,SAAQ,2BAA4C,EAAE,CAAC;IACxF,IAAa,OAAO,IAAI,MAAM,CAE7B;CACF;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,OAAO,SACZ,MAAM,eACA,cAAc,KACzB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,qBAAqB,CAS/D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert.test.d.ts","sourceRoot":"","sources":["../../../../src/dsl/convert.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsl.test.d.ts","sourceRoot":"","sources":["../../../../src/dsl/dsl.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diagram.d.ts","sourceRoot":"","sources":["../../../../../src/dsl/gen/diagram.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAA;AAElC,eAAO,MAAM,MAAM,UAkBjB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { type ConvertOptions, type Source, SOURCES, UndetectedSourceError, UnknownSourceError, convert, detect, } from './convert.ts';
|
|
2
|
+
export { type CompileOptions, compile } from './compile.ts';
|
|
3
|
+
export { type ParseResult, type Problem, type Range, type Reading, parse, parseScene, read, toScene, withLayout, } from './parse.ts';
|
|
4
|
+
export { formatCommand, formatElement, formatId, formatObject, formatString, print, printCommands } from './print.ts';
|
|
5
|
+
export { type AttrSpec, type AttrType, CLAUSE_KEYWORDS, DIAGRAM_ATTRS, EDGE_ATTRS, ELEMENT_ATTRS, ELEMENT_KINDS, type ElementKind, GROUP_ATTRS, NODE_ATTRS, OBJECT_ATTRS, RELATION_WORDS, RESERVED, SEMANTIC_KEYWORDS, STATEMENT_KEYWORDS, } from './vocabulary.ts';
|
|
6
|
+
export { parser } from './gen/diagram.ts';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/dsl/index.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,MAAM,EACX,OAAO,EACP,qBAAqB,EACrB,kBAAkB,EAClB,OAAO,EACP,MAAM,GACP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,cAAc,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5D,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,KAAK,EACV,KAAK,OAAO,EACZ,KAAK,EACL,UAAU,EACV,IAAI,EACJ,OAAO,EACP,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACtH,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,eAAe,EACf,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,EACb,KAAK,WAAW,EAChB,WAAW,EACX,UAAU,EACV,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as Scene from '../scene.ts';
|
|
2
|
+
import * as SemanticEngine from '../semantic-engine.ts';
|
|
3
|
+
import * as Semantic from '../semantic.ts';
|
|
4
|
+
export type Problem = {
|
|
5
|
+
severity: 'error' | 'warning';
|
|
6
|
+
message: string;
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
};
|
|
10
|
+
export type Range = {
|
|
11
|
+
from: number;
|
|
12
|
+
to: number;
|
|
13
|
+
};
|
|
14
|
+
export type ParseResult = {
|
|
15
|
+
commands: Scene.Command[];
|
|
16
|
+
problems: Problem[];
|
|
17
|
+
/**
|
|
18
|
+
* Source range of each `objectId` and `objectId/elementId` — the two spellings
|
|
19
|
+
* `Diagnostics.Diagnostic.refs` uses, so a layout report can be shown against the line that
|
|
20
|
+
* produced it rather than at the top of the document.
|
|
21
|
+
*/
|
|
22
|
+
ranges: Map<string, Range>;
|
|
23
|
+
};
|
|
24
|
+
/** A document as read, before any semantic statement is laid out. */
|
|
25
|
+
export type Reading = ParseResult & {
|
|
26
|
+
/** The semantic statements, when the document has any. */
|
|
27
|
+
diagram?: Semantic.Diagram;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Reads a document. Syntax errors are reported rather than thrown, and the commands that did parse
|
|
31
|
+
* are returned alongside them, so an editor can keep rendering the last good shapes while a line
|
|
32
|
+
* is half-typed. Semantic statements are collected into a diagram but not laid out.
|
|
33
|
+
*/
|
|
34
|
+
export declare const read: (text: string) => Reading;
|
|
35
|
+
/** A reading with its semantic diagram laid out: the layout's commands first, then the scene statements. */
|
|
36
|
+
export declare const withLayout: (reading: Reading, solution?: SemanticEngine.Solution) => ParseResult;
|
|
37
|
+
/**
|
|
38
|
+
* Reads a document and lays out its semantic statements with the grid search, synchronously, so
|
|
39
|
+
* an editor can lint and preview it; see {@link compile} for the full search.
|
|
40
|
+
*/
|
|
41
|
+
export declare const parse: (text: string) => ParseResult;
|
|
42
|
+
/** Applies commands in order, the same semantics `Scene.Command` documents. */
|
|
43
|
+
export declare const toScene: (commands: readonly Scene.Command[]) => Scene.Scene;
|
|
44
|
+
/** Convenience for the common case: a scene document, with whatever problems it carried. */
|
|
45
|
+
export declare const parseScene: (text: string) => {
|
|
46
|
+
scene: Scene.Scene;
|
|
47
|
+
problems: Problem[];
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/dsl/parse.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,MAAM,aAAa,CAAC;AACrC,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAe3C,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB;;;;OAIG;IACH,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAC5B,CAAC;AA0CF,qEAAqE;AACrE,MAAM,MAAM,OAAO,GAAG,WAAW,GAAG;IAClC,0DAA0D;IAC1D,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,IAAI,SAAU,MAAM,KAAG,OAi2BnC,CAAC;AAEF,4GAA4G;AAC5G,eAAO,MAAM,UAAU,YAAa,OAAO,aAAa,cAAc,CAAC,QAAQ,KAAG,WAIhF,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,KAAK,SAAU,MAAM,KAAG,WAGpC,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,OAAO,aAAc,SAAS,KAAK,CAAC,OAAO,EAAE,KAAG,KAAK,CAAC,KA8DlE,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,UAAU,SAAU,MAAM,KAAG;IAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC;IAAC,QAAQ,EAAE,OAAO,EAAE,CAAA;CAGlF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as Scene from '../scene.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Shortest form that reads back: integers keep no trailing zeros, negatives keep their sign, and
|
|
4
|
+
* the exponent notation `String` switches to outside ~1e-7..1e21 is spelled as-is, which the
|
|
5
|
+
* grammar accepts. `NaN` and `Infinity` have no readable form at all, so they are refused here
|
|
6
|
+
* rather than silently producing a document that cannot be parsed.
|
|
7
|
+
*/
|
|
8
|
+
export declare const formatNumber: (value: number) => string;
|
|
9
|
+
export declare const formatString: (value: string) => string;
|
|
10
|
+
/** Bare where the grammar allows it, quoted where a word would be read as a keyword or fail to lex. */
|
|
11
|
+
export declare const formatId: (id: string) => string;
|
|
12
|
+
export declare const formatElement: (element: Scene.Element) => string;
|
|
13
|
+
export declare const formatObject: (object: Scene.WorldObject) => string;
|
|
14
|
+
export declare const formatCommand: (command: Scene.Command) => string;
|
|
15
|
+
/** A whole document: statements separated by a blank line, newline-terminated. */
|
|
16
|
+
export declare const printCommands: (commands: readonly Scene.Command[]) => string;
|
|
17
|
+
/** A scene document — every statement an `object`, which is what a drawing serializes to. */
|
|
18
|
+
export declare const print: (scene: Scene.Scene) => string;
|
|
19
|
+
//# sourceMappingURL=print.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../../../src/dsl/print.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,KAAK,KAAK,MAAM,aAAa,CAAC;AAK1C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MAK5C,CAAC;AAEF,eAAO,MAAM,YAAY,UAAW,MAAM,KAAG,MACyC,CAAC;AAEvF,uGAAuG;AACvG,eAAO,MAAM,QAAQ,OAAQ,MAAM,KAAG,MAAyE,CAAC;AAoChH,eAAO,MAAM,aAAa,YAAa,KAAK,CAAC,OAAO,KAAG,MAsFtD,CAAC;AAKF,eAAO,MAAM,YAAY,WAAY,KAAK,CAAC,WAAW,KAAG,MAetD,CAAC;AAEJ,eAAO,MAAM,aAAa,YAAa,KAAK,CAAC,OAAO,KAAG,MAatD,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,aAAa,aAAc,SAAS,KAAK,CAAC,OAAO,EAAE,KAAG,MACW,CAAC;AAE/E,6FAA6F;AAC7F,eAAO,MAAM,KAAK,UAAW,KAAK,CAAC,KAAK,KAAG,MAC+C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic.test.d.ts","sourceRoot":"","sources":["../../../../src/dsl/semantic.test.ts"],"names":[],"mappings":""}
|