@standarx/graph 0.0.0-stage → 1.0.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 (127) hide show
  1. package/LICENSE +21 -0
  2. package/README.fr.md +436 -0
  3. package/README.md +435 -2
  4. package/THIRD_PARTY_NOTICES.md +22 -0
  5. package/assets/fonts/Inter-Regular.ttf +0 -0
  6. package/assets/fonts/Inter-SemiBold.ttf +0 -0
  7. package/assets/fonts/OFL.txt +92 -0
  8. package/dist/adapter-0bggwh8x.js +393 -0
  9. package/dist/cli-4m00785g.js +20 -0
  10. package/dist/cli-5v9761s9.js +330 -0
  11. package/dist/cli-9f1pdw5q.js +462 -0
  12. package/dist/cli-a4ax1vkc.js +172 -0
  13. package/dist/cli-b4n941t8.js +1439 -0
  14. package/dist/cli-eqq7a3wz.js +1144 -0
  15. package/dist/cli-gh5166k6.js +1565 -0
  16. package/dist/cli-kzp16pt5.js +207 -0
  17. package/dist/cli-mzmjkk5v.js +11 -0
  18. package/dist/cli-njgyf690.js +1060 -0
  19. package/dist/cli-nkm2j980.js +141 -0
  20. package/dist/cli-nyckgf1t.js +4 -0
  21. package/dist/cli-sfdqkbd1.js +433 -0
  22. package/dist/cli-txrzzr2q.js +0 -0
  23. package/dist/cli-vecew2na.js +709 -0
  24. package/dist/cli-wt9dmbhm.js +560 -0
  25. package/dist/cli-xhdxp3cj.js +387 -0
  26. package/dist/cli-ywgtv1cg.js +39 -0
  27. package/dist/cli.d.ts +2 -0
  28. package/dist/cli.js +415 -0
  29. package/dist/core/index.d.ts +6 -0
  30. package/dist/core/index.js +93 -0
  31. package/dist/core/spatial.d.ts +16 -0
  32. package/dist/core/threshold.d.ts +1 -0
  33. package/dist/core/view.d.ts +80 -0
  34. package/dist/export/index.d.ts +18 -0
  35. package/dist/export/index.js +172 -0
  36. package/dist/export/pdf.d.ts +5 -0
  37. package/dist/export/png.d.ts +4 -0
  38. package/dist/format/index.d.ts +4 -0
  39. package/dist/format/index.js +71 -0
  40. package/dist/format/json-schema.d.ts +2 -0
  41. package/dist/format/schema.d.ts +787 -0
  42. package/dist/format/semantic/er.d.ts +3 -0
  43. package/dist/format/semantic/graph.d.ts +3 -0
  44. package/dist/format/semantic/sequence.d.ts +3 -0
  45. package/dist/format/semantic/shared.d.ts +14 -0
  46. package/dist/format/semantic/state.d.ts +3 -0
  47. package/dist/format/semantic/tree.d.ts +3 -0
  48. package/dist/format/transition-label.d.ts +2 -0
  49. package/dist/format/validate.d.ts +11 -0
  50. package/dist/html/index.d.ts +3 -0
  51. package/dist/html/index.js +127 -0
  52. package/dist/html/layout-worker.d.ts +1 -0
  53. package/dist/html/layout-worker.generated.d.ts +1 -0
  54. package/dist/html/mount.d.ts +12 -0
  55. package/dist/html/page.d.ts +14 -0
  56. package/dist/html/render.d.ts +7 -0
  57. package/dist/html/runtime.d.ts +1 -0
  58. package/dist/html/runtime.generated.d.ts +1 -0
  59. package/dist/html/shell.d.ts +10 -0
  60. package/dist/html/svg-adapter.d.ts +8 -0
  61. package/dist/html/ui.d.ts +34 -0
  62. package/dist/language/analysis.d.ts +38 -0
  63. package/dist/language/complete.d.ts +3 -0
  64. package/dist/language/docs.d.ts +11 -0
  65. package/dist/language/format.d.ts +17 -0
  66. package/dist/language/hover.d.ts +3 -0
  67. package/dist/language/index.d.ts +6 -0
  68. package/dist/language/index.js +1385 -0
  69. package/dist/language/navigation.d.ts +9 -0
  70. package/dist/language/positions.d.ts +7 -0
  71. package/dist/language/symbols.d.ts +3 -0
  72. package/dist/language/types.d.ts +34 -0
  73. package/dist/layout/elk.d.ts +35 -0
  74. package/dist/layout/er.d.ts +3 -0
  75. package/dist/layout/font-metrics.d.ts +9 -0
  76. package/dist/layout/graph.d.ts +3 -0
  77. package/dist/layout/index.d.ts +5 -0
  78. package/dist/layout/index.js +17 -0
  79. package/dist/layout/measure.d.ts +10 -0
  80. package/dist/layout/sequence.d.ts +3 -0
  81. package/dist/layout/shapes.d.ts +16 -0
  82. package/dist/layout/shared.d.ts +31 -0
  83. package/dist/layout/state.d.ts +3 -0
  84. package/dist/layout/tree.d.ts +3 -0
  85. package/dist/layout/types.d.ts +198 -0
  86. package/dist/layout-worker.generated-emmvgfb1.js +34 -0
  87. package/dist/mermaid/common.d.ts +36 -0
  88. package/dist/mermaid/er.d.ts +3 -0
  89. package/dist/mermaid/graph.d.ts +4 -0
  90. package/dist/mermaid/index.d.ts +6 -0
  91. package/dist/mermaid/index.js +6 -0
  92. package/dist/mermaid/mindmap.d.ts +3 -0
  93. package/dist/mermaid/sequence.d.ts +3 -0
  94. package/dist/mermaid/state.d.ts +3 -0
  95. package/dist/remark/index.d.ts +9 -0
  96. package/dist/remark/index.js +104 -0
  97. package/dist/shared/errors.d.ts +6 -0
  98. package/dist/shared/package-root.d.ts +5 -0
  99. package/dist/svg/escape.d.ts +1 -0
  100. package/dist/svg/index.d.ts +3 -0
  101. package/dist/svg/index.js +25 -0
  102. package/dist/svg/render.d.ts +9 -0
  103. package/dist/svg/theme.d.ts +62 -0
  104. package/dist/svg-adapter-gq5vmp6q.js +227 -0
  105. package/dist/text/build.d.ts +10 -0
  106. package/dist/text/canonical.d.ts +10 -0
  107. package/dist/text/errors.d.ts +33 -0
  108. package/dist/text/highlight.d.ts +13 -0
  109. package/dist/text/index.d.ts +33 -0
  110. package/dist/text/index.js +27 -0
  111. package/dist/text/lexer.d.ts +29 -0
  112. package/dist/text/parser.d.ts +160 -0
  113. package/dist/text/print.d.ts +6 -0
  114. package/dist/text/slug.d.ts +1 -0
  115. package/dist/text/syntax.d.ts +8 -0
  116. package/dist/version.d.ts +1 -0
  117. package/dist/webgl/adapter.d.ts +4 -0
  118. package/dist/webgl/index.d.ts +7 -0
  119. package/dist/webgl/index.js +15 -0
  120. package/dist/webgl/runtime.d.ts +1 -0
  121. package/dist/webgl/runtime.generated.d.ts +1 -0
  122. package/grammars/standargraph.tmLanguage.json +599 -0
  123. package/language-configuration.json +35 -0
  124. package/licenses/EPL-2.0.txt +277 -0
  125. package/licenses/MPL-2.0.txt +373 -0
  126. package/package.json +133 -4
  127. package/schema/graph-document.v1.json +1737 -0
@@ -0,0 +1,9 @@
1
+ import type { Position, Range } from "./format";
2
+ import type { Location, WorkspaceEdit } from "./types";
3
+ export declare function definition(source: string, position: Position): Location | undefined;
4
+ export declare function references(source: string, position: Position, includeDeclaration?: boolean): Location[];
5
+ export declare function prepareRename(source: string, position: Position): {
6
+ range: Range;
7
+ placeholder: string;
8
+ } | undefined;
9
+ export declare function rename(source: string, position: Position, newName: string): WorkspaceEdit | undefined;
@@ -0,0 +1,7 @@
1
+ import type { Position } from "./format";
2
+ export type Converter = {
3
+ text: string;
4
+ position(offset: number): Position;
5
+ offset(position: Position): number;
6
+ };
7
+ export declare function converter(source: string): Converter;
@@ -0,0 +1,3 @@
1
+ import type { DocumentSymbol, FoldingRange } from "./types";
2
+ export declare function documentSymbols(source: string): DocumentSymbol[];
3
+ export declare function foldingRanges(source: string): FoldingRange[];
@@ -0,0 +1,34 @@
1
+ import type { Position, Range, TextEdit } from "./format";
2
+ export type { Position, Range, TextEdit };
3
+ export type SymbolKind = "class" | "object" | "field" | "event" | "namespace" | "struct" | "module";
4
+ export type DocumentSymbol = {
5
+ name: string;
6
+ detail?: string;
7
+ kind: SymbolKind;
8
+ range: Range;
9
+ selectionRange: Range;
10
+ children?: DocumentSymbol[];
11
+ };
12
+ export type FoldingRange = {
13
+ startLine: number;
14
+ endLine: number;
15
+ kind?: "comment" | "region";
16
+ };
17
+ export type Location = {
18
+ range: Range;
19
+ };
20
+ export type WorkspaceEdit = {
21
+ changes: TextEdit[];
22
+ };
23
+ export type Hover = {
24
+ contents: string;
25
+ range: Range;
26
+ };
27
+ export type CompletionItemKind = "keyword" | "operator" | "property" | "value" | "reference";
28
+ export type CompletionItem = {
29
+ label: string;
30
+ kind: CompletionItemKind;
31
+ detail?: string;
32
+ documentation?: string;
33
+ insertText?: string;
34
+ };
@@ -0,0 +1,35 @@
1
+ import type { GraphDocument } from "../format";
2
+ import type { Box, Point } from "./types";
3
+ export type Direction = NonNullable<GraphDocument["direction"]>;
4
+ export type ElkBoxInput = {
5
+ id: string;
6
+ width: number;
7
+ height: number;
8
+ padding?: {
9
+ top: number;
10
+ left: number;
11
+ bottom: number;
12
+ right: number;
13
+ };
14
+ minWidth?: number;
15
+ children?: ElkBoxInput[];
16
+ };
17
+ export type ElkEdgeInput = {
18
+ id: string;
19
+ from: string;
20
+ to: string;
21
+ label?: {
22
+ width: number;
23
+ height: number;
24
+ };
25
+ };
26
+ export type ElkResult = {
27
+ width: number;
28
+ height: number;
29
+ boxes: Map<string, Box>;
30
+ routes: Map<string, {
31
+ points: Point[];
32
+ labelBox?: Box;
33
+ }>;
34
+ };
35
+ export declare function runElk(direction: Direction, children: ElkBoxInput[], edges: ElkEdgeInput[]): Promise<ElkResult>;
@@ -0,0 +1,3 @@
1
+ import type { ErDocument } from "../format";
2
+ import type { LaidOutEr } from "./types";
3
+ export declare function layoutEr(doc: ErDocument): Promise<LaidOutEr>;
@@ -0,0 +1,9 @@
1
+ export type FontWeight = "regular" | "semibold";
2
+ export type FontMetrics = {
3
+ unitsPerEm: number;
4
+ ascender: number;
5
+ descender: number;
6
+ fallback: number;
7
+ advances: Readonly<Record<number, number>>;
8
+ };
9
+ export declare const FONT_METRICS: Record<FontWeight, FontMetrics>;
@@ -0,0 +1,3 @@
1
+ import type { GraphDocument } from "../format";
2
+ import type { LaidOutGraph } from "./types";
3
+ export declare function layoutGraph(doc: GraphDocument): Promise<LaidOutGraph>;
@@ -0,0 +1,5 @@
1
+ import type { LaidOut } from "./types";
2
+ export { VERSION } from "../version";
3
+ export { measureText, type TextOptions } from "./measure";
4
+ export type * from "./types";
5
+ export declare function layout(document: unknown): Promise<LaidOut>;
@@ -0,0 +1,17 @@
1
+ import {
2
+ layout2
3
+ } from "../cli-eqq7a3wz.js";
4
+ import"../cli-txrzzr2q.js";
5
+ import"../cli-xhdxp3cj.js";
6
+ import"../cli-kzp16pt5.js";
7
+ import {
8
+ measureText2
9
+ } from "../cli-gh5166k6.js";
10
+ import {
11
+ VERSION2
12
+ } from "../cli-nkm2j980.js";
13
+ export {
14
+ VERSION2 as VERSION,
15
+ layout2 as layout,
16
+ measureText2 as measureText
17
+ };
@@ -0,0 +1,10 @@
1
+ import { type FontWeight } from "./font-metrics";
2
+ export type TextOptions = {
3
+ size: number;
4
+ weight: FontWeight;
5
+ };
6
+ export declare const LINE_HEIGHT = 1.25;
7
+ export declare function measureText(text: string, options: TextOptions): {
8
+ width: number;
9
+ height: number;
10
+ };
@@ -0,0 +1,3 @@
1
+ import type { SequenceDocument } from "../format";
2
+ import type { LaidOutSequence } from "./types";
3
+ export declare function layoutSequence(doc: SequenceDocument): LaidOutSequence;
@@ -0,0 +1,16 @@
1
+ import type { Shape } from "../format";
2
+ import type { Box, Point } from "./types";
3
+ export declare const CYLINDER_RY = 7;
4
+ export declare const DOCUMENT_WAVE = 6;
5
+ type Size = {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ export declare const SUBROUTINE_BAR = 8;
10
+ export declare function shapeSize(shape: Shape | undefined, label: string, type: string | undefined, minWidth: number): Size;
11
+ export declare function textOffsetY(shape: Shape | undefined): number;
12
+ export declare function outline(shape: Shape | undefined, box: Box): Point[] | undefined;
13
+ export declare function clipEnds(points: readonly Point[], fromShape: Shape | undefined, fromBox: Box, toShape: Shape | undefined, toBox: Box): Point[];
14
+ export declare function clipToRect(rect: Box, toward: Point): Point;
15
+ export declare function clipToShape(shape: Shape | undefined, rect: Box, toward: Point): Point;
16
+ export {};
@@ -0,0 +1,31 @@
1
+ import { type TextOptions } from "./measure";
2
+ export declare const MARGIN = 20;
3
+ export declare const LABEL_FONT: TextOptions;
4
+ export declare const CAPTION_FONT: TextOptions;
5
+ export declare const EDGE_LABEL_FONT: TextOptions;
6
+ export declare const GROUP_FONT: TextOptions;
7
+ export declare const PAD_X = 12;
8
+ export declare const PAD_Y = 8;
9
+ export declare const SELF_LOOP_WIDTH = 30;
10
+ export declare const SELF_LOOP_HEIGHT = 20;
11
+ export declare function round(value: number): number;
12
+ export declare function compact<T extends object>(value: T): T;
13
+ export declare function boxSize(label: string, type: string | undefined, minWidth: number): {
14
+ width: number;
15
+ height: number;
16
+ };
17
+ export declare function labelBoxSize(label: string): {
18
+ width: number;
19
+ height: number;
20
+ };
21
+ export declare function groupTopPadding(label: string | undefined): number;
22
+ export declare const ACTIONS_GAP = 6;
23
+ export declare function actionsHeight(count: number): number;
24
+ export declare function actionsWidth(actions: readonly string[]): number;
25
+ export declare const ER_ROW_HEIGHT: number;
26
+ export declare const ER_ROWS_PAD = 3;
27
+ export declare function keysText(keys: readonly string[] | undefined): string;
28
+ export declare function attributeTypeText(attribute: {
29
+ type?: string;
30
+ nullable?: boolean;
31
+ }): string;
@@ -0,0 +1,3 @@
1
+ import type { StateDocument } from "../format";
2
+ import type { LaidOutStateMachine } from "./types";
3
+ export declare function layoutState(doc: StateDocument): Promise<LaidOutStateMachine>;
@@ -0,0 +1,3 @@
1
+ import type { TreeDocument } from "../format";
2
+ import type { LaidOutTree } from "./types";
3
+ export declare function layoutTree(doc: TreeDocument): LaidOutTree;
@@ -0,0 +1,198 @@
1
+ import type { Cardinality, Key, Meta, Pseudo, Shape } from "../format";
2
+ export type Point = {
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export type Box = {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ };
12
+ export type LaidOutGroup = {
13
+ id: string;
14
+ label?: string;
15
+ x: number;
16
+ y: number;
17
+ width: number;
18
+ height: number;
19
+ depth: number;
20
+ meta?: Meta;
21
+ };
22
+ export type LaidOutNode = {
23
+ id: string;
24
+ label: string;
25
+ type?: string;
26
+ shape?: Shape;
27
+ x: number;
28
+ y: number;
29
+ width: number;
30
+ height: number;
31
+ group?: string;
32
+ link?: string;
33
+ description?: string;
34
+ meta?: Meta;
35
+ };
36
+ export type LaidOutEdge = {
37
+ id: string;
38
+ from: string;
39
+ to: string;
40
+ label?: string;
41
+ type?: string;
42
+ directed: boolean;
43
+ points: Point[];
44
+ labelBox?: Box;
45
+ meta?: Meta;
46
+ };
47
+ export type LaidOutGraph = {
48
+ kind: "graph";
49
+ width: number;
50
+ height: number;
51
+ title?: string;
52
+ groups: LaidOutGroup[];
53
+ nodes: LaidOutNode[];
54
+ edges: LaidOutEdge[];
55
+ };
56
+ export type LaidOutParticipant = {
57
+ id: string;
58
+ label: string;
59
+ type?: string;
60
+ x: number;
61
+ y: number;
62
+ width: number;
63
+ height: number;
64
+ lifelineX: number;
65
+ meta?: Meta;
66
+ };
67
+ export type MessageStyle = "sync" | "async" | "reply";
68
+ export type LaidOutMessage = {
69
+ index: number;
70
+ from: string;
71
+ to: string;
72
+ label?: string;
73
+ style: MessageStyle;
74
+ y: number;
75
+ x1: number;
76
+ x2: number;
77
+ self: boolean;
78
+ labelBox?: Box;
79
+ meta?: Meta;
80
+ };
81
+ export type LaidOutSequence = {
82
+ kind: "sequence";
83
+ width: number;
84
+ height: number;
85
+ title?: string;
86
+ participants: LaidOutParticipant[];
87
+ messages: LaidOutMessage[];
88
+ lifelineBottom: number;
89
+ };
90
+ export type LaidOutState = {
91
+ id: string;
92
+ label: string;
93
+ type?: string;
94
+ pseudo?: Pseudo;
95
+ composite: boolean;
96
+ parent?: string;
97
+ depth: number;
98
+ actions?: string[];
99
+ description?: string;
100
+ link?: string;
101
+ x: number;
102
+ y: number;
103
+ width: number;
104
+ height: number;
105
+ meta?: Meta;
106
+ };
107
+ export type LaidOutTransition = {
108
+ id: string;
109
+ from: string;
110
+ to: string;
111
+ label?: string;
112
+ event?: string;
113
+ guard?: string;
114
+ action?: string;
115
+ type?: string;
116
+ points: Point[];
117
+ labelBox?: Box;
118
+ meta?: Meta;
119
+ };
120
+ export type LaidOutStateMachine = {
121
+ kind: "state";
122
+ width: number;
123
+ height: number;
124
+ title?: string;
125
+ states: LaidOutState[];
126
+ transitions: LaidOutTransition[];
127
+ };
128
+ export type LaidOutAttribute = {
129
+ name: string;
130
+ type?: string;
131
+ keys?: Key[];
132
+ nullable?: boolean;
133
+ note?: string;
134
+ y: number;
135
+ height: number;
136
+ };
137
+ export type LaidOutEntity = {
138
+ id: string;
139
+ label: string;
140
+ type?: string;
141
+ x: number;
142
+ y: number;
143
+ width: number;
144
+ height: number;
145
+ headerHeight: number;
146
+ columns: {
147
+ key: number;
148
+ name: number;
149
+ type: number;
150
+ };
151
+ attributes: LaidOutAttribute[];
152
+ description?: string;
153
+ link?: string;
154
+ meta?: Meta;
155
+ };
156
+ export type LaidOutRelation = {
157
+ id: string;
158
+ from: string;
159
+ to: string;
160
+ label?: string;
161
+ fromCardinality?: Cardinality;
162
+ toCardinality?: Cardinality;
163
+ identifying: boolean;
164
+ type?: string;
165
+ points: Point[];
166
+ labelBox?: Box;
167
+ meta?: Meta;
168
+ };
169
+ export type LaidOutEr = {
170
+ kind: "er";
171
+ width: number;
172
+ height: number;
173
+ title?: string;
174
+ entities: LaidOutEntity[];
175
+ relations: LaidOutRelation[];
176
+ };
177
+ export type LaidOutTreeNode = LaidOutNode & {
178
+ depth: number;
179
+ parent?: string;
180
+ side?: "left" | "right";
181
+ };
182
+ export type LaidOutTreeEdge = {
183
+ id: string;
184
+ from: string;
185
+ to: string;
186
+ points: Point[];
187
+ curve: "elbow" | "bezier";
188
+ };
189
+ export type LaidOutTree = {
190
+ kind: "tree";
191
+ layout: "tree" | "mindmap";
192
+ width: number;
193
+ height: number;
194
+ title?: string;
195
+ nodes: LaidOutTreeNode[];
196
+ edges: LaidOutTreeEdge[];
197
+ };
198
+ export type LaidOut = LaidOutGraph | LaidOutSequence | LaidOutStateMachine | LaidOutEr | LaidOutTree;