@standarx/graph 0.0.0-stage → 1.1.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 +438 -0
  3. package/README.md +437 -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-abzdy8pn.js +1144 -0
  14. package/dist/cli-gh5166k6.js +1565 -0
  15. package/dist/cli-m29a3wgx.js +579 -0
  16. package/dist/cli-mzmjkk5v.js +11 -0
  17. package/dist/cli-nhmh6yxk.js +2485 -0
  18. package/dist/cli-nyckgf1t.js +4 -0
  19. package/dist/cli-sfdqkbd1.js +433 -0
  20. package/dist/cli-txrzzr2q.js +0 -0
  21. package/dist/cli-vecew2na.js +709 -0
  22. package/dist/cli-wt9dmbhm.js +560 -0
  23. package/dist/cli-ywgtv1cg.js +39 -0
  24. package/dist/cli-z3ccx2y4.js +141 -0
  25. package/dist/cli.d.ts +2 -0
  26. package/dist/cli.js +413 -0
  27. package/dist/core/index.d.ts +6 -0
  28. package/dist/core/index.js +91 -0
  29. package/dist/core/spatial.d.ts +16 -0
  30. package/dist/core/threshold.d.ts +1 -0
  31. package/dist/core/view.d.ts +80 -0
  32. package/dist/export/index.d.ts +18 -0
  33. package/dist/export/index.js +170 -0
  34. package/dist/export/pdf.d.ts +5 -0
  35. package/dist/export/png.d.ts +4 -0
  36. package/dist/format/index.d.ts +4 -0
  37. package/dist/format/index.js +69 -0
  38. package/dist/format/json-schema.d.ts +2 -0
  39. package/dist/format/schema.d.ts +787 -0
  40. package/dist/format/semantic/er.d.ts +3 -0
  41. package/dist/format/semantic/graph.d.ts +3 -0
  42. package/dist/format/semantic/sequence.d.ts +3 -0
  43. package/dist/format/semantic/shared.d.ts +14 -0
  44. package/dist/format/semantic/state.d.ts +3 -0
  45. package/dist/format/semantic/tree.d.ts +3 -0
  46. package/dist/format/transition-label.d.ts +2 -0
  47. package/dist/format/validate.d.ts +11 -0
  48. package/dist/html/index.d.ts +3 -0
  49. package/dist/html/index.js +125 -0
  50. package/dist/html/layout-worker.d.ts +1 -0
  51. package/dist/html/layout-worker.generated.d.ts +1 -0
  52. package/dist/html/mount.d.ts +12 -0
  53. package/dist/html/page.d.ts +14 -0
  54. package/dist/html/render.d.ts +7 -0
  55. package/dist/html/runtime.d.ts +1 -0
  56. package/dist/html/runtime.generated.d.ts +1 -0
  57. package/dist/html/shell.d.ts +10 -0
  58. package/dist/html/svg-adapter.d.ts +8 -0
  59. package/dist/html/ui.d.ts +34 -0
  60. package/dist/language/actions.d.ts +3 -0
  61. package/dist/language/analysis.d.ts +38 -0
  62. package/dist/language/complete.d.ts +3 -0
  63. package/dist/language/diagnostics.d.ts +14 -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 +8 -0
  68. package/dist/language/index.js +1560 -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 +46 -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 +16 -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-xsmtzrfj.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 +102 -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 +25 -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,29 @@
1
+ import { Sink, type Range, type TextError } from "./errors";
2
+ export type TokenKind = "NEWLINE" | "STRING" | "QUOTED_ID" | "REPLY" | "ASYNC" | "ARROW" | "LINE" | "CARD" | "DOTS" | "PUNCT" | "NUMBER" | "IDENT" | "ERROR" | "EOF";
3
+ export type Token = {
4
+ kind: TokenKind;
5
+ text: string;
6
+ value: string;
7
+ start: number;
8
+ end: number;
9
+ };
10
+ export declare const IDENT: RegExp;
11
+ export declare function normalize(source: string): string;
12
+ export declare class Lexer {
13
+ private readonly source;
14
+ private readonly sink;
15
+ private readonly comments?;
16
+ pos: number;
17
+ private depth;
18
+ private openAt;
19
+ constructor(source: string, sink: Sink, comments?: Range[] | undefined);
20
+ seek(pos: number): void;
21
+ next(): Token;
22
+ private token;
23
+ private advance;
24
+ private quoted;
25
+ }
26
+ export declare function tokenize(source: string): {
27
+ tokens: Token[];
28
+ errors: TextError[];
29
+ };
@@ -0,0 +1,160 @@
1
+ import type { Cardinality } from "../format/schema";
2
+ import { type Range, type Sink } from "./errors";
3
+ import { type Token } from "./lexer";
4
+ export type Kind = "graph" | "sequence" | "state" | "er" | "tree";
5
+ export type OpSymbol = "->" | "--" | "->>" | "-->" | "..";
6
+ export type Str = {
7
+ value: string;
8
+ range: Range;
9
+ };
10
+ export type Ident = {
11
+ value: string;
12
+ range: Range;
13
+ };
14
+ export type Value = {
15
+ type: "string";
16
+ value: string;
17
+ range: Range;
18
+ } | {
19
+ type: "number";
20
+ value: number;
21
+ range: Range;
22
+ } | {
23
+ type: "ident";
24
+ value: string;
25
+ range: Range;
26
+ } | {
27
+ type: "list";
28
+ items: Value[];
29
+ range: Range;
30
+ };
31
+ export type AttrNode = {
32
+ key: string;
33
+ keyRange: Range;
34
+ value: Value;
35
+ range: Range;
36
+ };
37
+ export type Op = {
38
+ symbol: OpSymbol;
39
+ range: Range;
40
+ };
41
+ export type Endpoint = {
42
+ star: boolean;
43
+ value: string;
44
+ range: Range;
45
+ };
46
+ export type Card = {
47
+ value: Cardinality;
48
+ range: Range;
49
+ };
50
+ export type Opener = {
51
+ text: "{" | "do";
52
+ range: Range;
53
+ };
54
+ type Common = {
55
+ label?: Str;
56
+ attrs: AttrNode[];
57
+ range: Range;
58
+ incomplete?: true;
59
+ };
60
+ export type GraphStmt = ({
61
+ t: "group";
62
+ id: Ident;
63
+ body: GraphStmt[];
64
+ } & Common) | ({
65
+ t: "node";
66
+ id: Ident;
67
+ } & Common) | ({
68
+ t: "chain";
69
+ ids: Ident[];
70
+ ops: Op[];
71
+ } & Common);
72
+ export type SequenceStmt = ({
73
+ t: "participant";
74
+ id: Ident;
75
+ } & Common) | ({
76
+ t: "message";
77
+ from: Ident;
78
+ to: Ident;
79
+ op: Op;
80
+ } & Common);
81
+ export type StateStmt = ({
82
+ t: "state";
83
+ id: Ident;
84
+ body?: StateStmt[];
85
+ } & Common) | ({
86
+ t: "transition";
87
+ from: Endpoint;
88
+ to: Endpoint;
89
+ op: Op;
90
+ } & Common);
91
+ export type AttributeLine = {
92
+ name: Ident;
93
+ type?: Str;
94
+ flags: {
95
+ value: string;
96
+ range: Range;
97
+ }[];
98
+ attrs: AttrNode[];
99
+ range: Range;
100
+ incomplete?: true;
101
+ };
102
+ export type ErStmt = ({
103
+ t: "entity";
104
+ id: Ident;
105
+ attributes?: AttributeLine[];
106
+ } & Common) | ({
107
+ t: "relation";
108
+ from: Ident;
109
+ fromCard?: Card;
110
+ op: Op;
111
+ toCard?: Card;
112
+ to: Ident;
113
+ } & Common);
114
+ export type TreeLine = {
115
+ label: Str;
116
+ attrs: AttrNode[];
117
+ parent: number;
118
+ range: Range;
119
+ incomplete?: true;
120
+ };
121
+ export type Header = {
122
+ kindRange: Range;
123
+ title?: Str;
124
+ attrs: AttrNode[];
125
+ range: Range;
126
+ missing?: true;
127
+ };
128
+ export type Ast = {
129
+ kind: "graph";
130
+ header: Header;
131
+ body: GraphStmt[];
132
+ } | {
133
+ kind: "sequence";
134
+ header: Header;
135
+ body: SequenceStmt[];
136
+ } | {
137
+ kind: "state";
138
+ header: Header;
139
+ body: StateStmt[];
140
+ } | {
141
+ kind: "er";
142
+ header: Header;
143
+ body: ErStmt[];
144
+ } | {
145
+ kind: "tree";
146
+ header: Header;
147
+ body: TreeLine[];
148
+ };
149
+ export declare const KINDS: readonly Kind[];
150
+ export declare const FLAGS: Set<string>;
151
+ export declare const CARDINALITIES: ReadonlyMap<string, Cardinality>;
152
+ export declare const OPERATOR_WORDS: ReadonlyMap<string, OpSymbol>;
153
+ export declare const OPERATOR_RULES: Readonly<Record<Kind, {
154
+ noun: string;
155
+ allowed: readonly OpSymbol[];
156
+ }>>;
157
+ export declare function operatorOf(token: Token): OpSymbol | undefined;
158
+ export declare function parseSyntax(source: string, sink: Sink): Ast | undefined;
159
+ export declare function parseSyntaxPartial(source: string, sink: Sink): Ast;
160
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { Document } from "../format/schema";
2
+ export type PrintStyle = "symbols" | "words";
3
+ export type PrintOptions = {
4
+ style?: PrintStyle;
5
+ };
6
+ export declare function print(doc: Document, options?: PrintOptions): string;
@@ -0,0 +1 @@
1
+ export declare function slug(label: string): string;
@@ -0,0 +1,8 @@
1
+ import { type TextError } from "./errors";
2
+ import { type Ast } from "./parser";
3
+ export type SyntaxResult = {
4
+ ast: Ast;
5
+ errors: TextError[];
6
+ text: string;
7
+ };
8
+ export declare function parseTree(source: string): SyntaxResult;
@@ -0,0 +1 @@
1
+ export declare const VERSION: string;
@@ -0,0 +1,4 @@
1
+ import type { Document } from "../format";
2
+ import type { LaidOut } from "../layout/types";
3
+ import type { Mounted } from "../html/svg-adapter";
4
+ export declare function startWebgl(doc: Document, scene: LaidOut): Mounted | undefined;
@@ -0,0 +1,7 @@
1
+ import type { Document } from "../format";
2
+ import type { LaidOut } from "../layout/types";
3
+ import { type PageOptions } from "../html/shell";
4
+ export { WEBGL_THRESHOLD } from "../core/threshold";
5
+ export { VERSION } from "../version";
6
+ export type WebglOptions = PageOptions;
7
+ export declare function renderWebglHtml(document: Document, laidOut: LaidOut, options?: WebglOptions): string;
@@ -0,0 +1,15 @@
1
+ import {
2
+ renderWebglHtml2
3
+ } from "../cli-a4ax1vkc.js";
4
+ import {
5
+ WEBGL_THRESHOLD2
6
+ } from "../cli-nyckgf1t.js";
7
+ import"../cli-5v9761s9.js";
8
+ import {
9
+ VERSION2
10
+ } from "../cli-z3ccx2y4.js";
11
+ export {
12
+ VERSION2 as VERSION,
13
+ WEBGL_THRESHOLD2 as WEBGL_THRESHOLD,
14
+ renderWebglHtml2 as renderWebglHtml
15
+ };
@@ -0,0 +1 @@
1
+ export {};