@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.
- package/LICENSE +21 -0
- package/README.fr.md +436 -0
- package/README.md +435 -2
- package/THIRD_PARTY_NOTICES.md +22 -0
- package/assets/fonts/Inter-Regular.ttf +0 -0
- package/assets/fonts/Inter-SemiBold.ttf +0 -0
- package/assets/fonts/OFL.txt +92 -0
- package/dist/adapter-0bggwh8x.js +393 -0
- package/dist/cli-4m00785g.js +20 -0
- package/dist/cli-5v9761s9.js +330 -0
- package/dist/cli-9f1pdw5q.js +462 -0
- package/dist/cli-a4ax1vkc.js +172 -0
- package/dist/cli-b4n941t8.js +1439 -0
- package/dist/cli-eqq7a3wz.js +1144 -0
- package/dist/cli-gh5166k6.js +1565 -0
- package/dist/cli-kzp16pt5.js +207 -0
- package/dist/cli-mzmjkk5v.js +11 -0
- package/dist/cli-njgyf690.js +1060 -0
- package/dist/cli-nkm2j980.js +141 -0
- package/dist/cli-nyckgf1t.js +4 -0
- package/dist/cli-sfdqkbd1.js +433 -0
- package/dist/cli-txrzzr2q.js +0 -0
- package/dist/cli-vecew2na.js +709 -0
- package/dist/cli-wt9dmbhm.js +560 -0
- package/dist/cli-xhdxp3cj.js +387 -0
- package/dist/cli-ywgtv1cg.js +39 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +415 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +93 -0
- package/dist/core/spatial.d.ts +16 -0
- package/dist/core/threshold.d.ts +1 -0
- package/dist/core/view.d.ts +80 -0
- package/dist/export/index.d.ts +18 -0
- package/dist/export/index.js +172 -0
- package/dist/export/pdf.d.ts +5 -0
- package/dist/export/png.d.ts +4 -0
- package/dist/format/index.d.ts +4 -0
- package/dist/format/index.js +71 -0
- package/dist/format/json-schema.d.ts +2 -0
- package/dist/format/schema.d.ts +787 -0
- package/dist/format/semantic/er.d.ts +3 -0
- package/dist/format/semantic/graph.d.ts +3 -0
- package/dist/format/semantic/sequence.d.ts +3 -0
- package/dist/format/semantic/shared.d.ts +14 -0
- package/dist/format/semantic/state.d.ts +3 -0
- package/dist/format/semantic/tree.d.ts +3 -0
- package/dist/format/transition-label.d.ts +2 -0
- package/dist/format/validate.d.ts +11 -0
- package/dist/html/index.d.ts +3 -0
- package/dist/html/index.js +127 -0
- package/dist/html/layout-worker.d.ts +1 -0
- package/dist/html/layout-worker.generated.d.ts +1 -0
- package/dist/html/mount.d.ts +12 -0
- package/dist/html/page.d.ts +14 -0
- package/dist/html/render.d.ts +7 -0
- package/dist/html/runtime.d.ts +1 -0
- package/dist/html/runtime.generated.d.ts +1 -0
- package/dist/html/shell.d.ts +10 -0
- package/dist/html/svg-adapter.d.ts +8 -0
- package/dist/html/ui.d.ts +34 -0
- package/dist/language/analysis.d.ts +38 -0
- package/dist/language/complete.d.ts +3 -0
- package/dist/language/docs.d.ts +11 -0
- package/dist/language/format.d.ts +17 -0
- package/dist/language/hover.d.ts +3 -0
- package/dist/language/index.d.ts +6 -0
- package/dist/language/index.js +1385 -0
- package/dist/language/navigation.d.ts +9 -0
- package/dist/language/positions.d.ts +7 -0
- package/dist/language/symbols.d.ts +3 -0
- package/dist/language/types.d.ts +34 -0
- package/dist/layout/elk.d.ts +35 -0
- package/dist/layout/er.d.ts +3 -0
- package/dist/layout/font-metrics.d.ts +9 -0
- package/dist/layout/graph.d.ts +3 -0
- package/dist/layout/index.d.ts +5 -0
- package/dist/layout/index.js +17 -0
- package/dist/layout/measure.d.ts +10 -0
- package/dist/layout/sequence.d.ts +3 -0
- package/dist/layout/shapes.d.ts +16 -0
- package/dist/layout/shared.d.ts +31 -0
- package/dist/layout/state.d.ts +3 -0
- package/dist/layout/tree.d.ts +3 -0
- package/dist/layout/types.d.ts +198 -0
- package/dist/layout-worker.generated-emmvgfb1.js +34 -0
- package/dist/mermaid/common.d.ts +36 -0
- package/dist/mermaid/er.d.ts +3 -0
- package/dist/mermaid/graph.d.ts +4 -0
- package/dist/mermaid/index.d.ts +6 -0
- package/dist/mermaid/index.js +6 -0
- package/dist/mermaid/mindmap.d.ts +3 -0
- package/dist/mermaid/sequence.d.ts +3 -0
- package/dist/mermaid/state.d.ts +3 -0
- package/dist/remark/index.d.ts +9 -0
- package/dist/remark/index.js +104 -0
- package/dist/shared/errors.d.ts +6 -0
- package/dist/shared/package-root.d.ts +5 -0
- package/dist/svg/escape.d.ts +1 -0
- package/dist/svg/index.d.ts +3 -0
- package/dist/svg/index.js +25 -0
- package/dist/svg/render.d.ts +9 -0
- package/dist/svg/theme.d.ts +62 -0
- package/dist/svg-adapter-gq5vmp6q.js +227 -0
- package/dist/text/build.d.ts +10 -0
- package/dist/text/canonical.d.ts +10 -0
- package/dist/text/errors.d.ts +33 -0
- package/dist/text/highlight.d.ts +13 -0
- package/dist/text/index.d.ts +33 -0
- package/dist/text/index.js +27 -0
- package/dist/text/lexer.d.ts +29 -0
- package/dist/text/parser.d.ts +160 -0
- package/dist/text/print.d.ts +6 -0
- package/dist/text/slug.d.ts +1 -0
- package/dist/text/syntax.d.ts +8 -0
- package/dist/version.d.ts +1 -0
- package/dist/webgl/adapter.d.ts +4 -0
- package/dist/webgl/index.d.ts +7 -0
- package/dist/webgl/index.js +15 -0
- package/dist/webgl/runtime.d.ts +1 -0
- package/dist/webgl/runtime.generated.d.ts +1 -0
- package/grammars/standargraph.tmLanguage.json +599 -0
- package/language-configuration.json +35 -0
- package/licenses/EPL-2.0.txt +277 -0
- package/licenses/MPL-2.0.txt +373 -0
- package/package.json +133 -4
- package/schema/graph-document.v1.json +1737 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
// src/format/schema.ts
|
|
2
|
+
import { Type } from "@sinclair/typebox";
|
|
3
|
+
var FORMAT_VERSION2 = 1;
|
|
4
|
+
var Id = Type.String({ minLength: 1 });
|
|
5
|
+
var ProvenanceSchema2 = Type.Object({
|
|
6
|
+
source: Type.String({ minLength: 1 }),
|
|
7
|
+
confidence: Type.Optional(Type.Union([
|
|
8
|
+
Type.Literal("confirmed"),
|
|
9
|
+
Type.Literal("inferred"),
|
|
10
|
+
Type.Literal("unknown")
|
|
11
|
+
])),
|
|
12
|
+
tool: Type.Optional(Type.String())
|
|
13
|
+
}, { additionalProperties: false });
|
|
14
|
+
var MetaSchema2 = Type.Object({
|
|
15
|
+
provenance: Type.Optional(ProvenanceSchema2),
|
|
16
|
+
coverage: Type.Optional(Type.Number({ minimum: 0, maximum: 1 })),
|
|
17
|
+
freshness: Type.Optional(Type.String({ format: "date-time" })),
|
|
18
|
+
data: Type.Optional(Type.Record(Type.String(), Type.Union([Type.String(), Type.Number(), Type.Boolean()])))
|
|
19
|
+
}, { additionalProperties: false });
|
|
20
|
+
var SHAPES2 = [
|
|
21
|
+
"box",
|
|
22
|
+
"rect",
|
|
23
|
+
"pill",
|
|
24
|
+
"diamond",
|
|
25
|
+
"circle",
|
|
26
|
+
"ellipse",
|
|
27
|
+
"hexagon",
|
|
28
|
+
"parallelogram",
|
|
29
|
+
"cylinder",
|
|
30
|
+
"document",
|
|
31
|
+
"subroutine"
|
|
32
|
+
];
|
|
33
|
+
var ShapeSchema2 = Type.Union(SHAPES2.map((shape) => Type.Literal(shape)));
|
|
34
|
+
var NodeSchema2 = Type.Object({
|
|
35
|
+
id: Id,
|
|
36
|
+
label: Type.Optional(Type.String()),
|
|
37
|
+
type: Type.Optional(Type.String()),
|
|
38
|
+
shape: Type.Optional(ShapeSchema2),
|
|
39
|
+
group: Type.Optional(Type.String()),
|
|
40
|
+
description: Type.Optional(Type.String()),
|
|
41
|
+
link: Type.Optional(Type.String()),
|
|
42
|
+
position: Type.Optional(Type.Object({ x: Type.Number(), y: Type.Number() }, { additionalProperties: false })),
|
|
43
|
+
meta: Type.Optional(MetaSchema2)
|
|
44
|
+
}, { additionalProperties: false });
|
|
45
|
+
var EdgeSchema2 = Type.Object({
|
|
46
|
+
id: Type.Optional(Id),
|
|
47
|
+
from: Type.String(),
|
|
48
|
+
to: Type.String(),
|
|
49
|
+
label: Type.Optional(Type.String()),
|
|
50
|
+
type: Type.Optional(Type.String()),
|
|
51
|
+
directed: Type.Optional(Type.Boolean()),
|
|
52
|
+
meta: Type.Optional(MetaSchema2)
|
|
53
|
+
}, { additionalProperties: false });
|
|
54
|
+
var GroupSchema2 = Type.Object({
|
|
55
|
+
id: Id,
|
|
56
|
+
label: Type.Optional(Type.String()),
|
|
57
|
+
parent: Type.Optional(Type.String()),
|
|
58
|
+
meta: Type.Optional(MetaSchema2)
|
|
59
|
+
}, { additionalProperties: false });
|
|
60
|
+
var DirectionSchema2 = Type.Union([
|
|
61
|
+
Type.Literal("down"),
|
|
62
|
+
Type.Literal("right"),
|
|
63
|
+
Type.Literal("up"),
|
|
64
|
+
Type.Literal("left")
|
|
65
|
+
]);
|
|
66
|
+
var GraphDocumentSchema2 = Type.Object({
|
|
67
|
+
$schema: Type.Optional(Type.String()),
|
|
68
|
+
version: Type.Literal(FORMAT_VERSION2),
|
|
69
|
+
kind: Type.Literal("graph"),
|
|
70
|
+
title: Type.Optional(Type.String()),
|
|
71
|
+
direction: Type.Optional(DirectionSchema2),
|
|
72
|
+
nodes: Type.Array(NodeSchema2),
|
|
73
|
+
edges: Type.Optional(Type.Array(EdgeSchema2)),
|
|
74
|
+
groups: Type.Optional(Type.Array(GroupSchema2)),
|
|
75
|
+
meta: Type.Optional(MetaSchema2)
|
|
76
|
+
}, { additionalProperties: false });
|
|
77
|
+
var ParticipantSchema2 = Type.Object({
|
|
78
|
+
id: Id,
|
|
79
|
+
label: Type.Optional(Type.String()),
|
|
80
|
+
type: Type.Optional(Type.String()),
|
|
81
|
+
meta: Type.Optional(MetaSchema2)
|
|
82
|
+
}, { additionalProperties: false });
|
|
83
|
+
var MessageSchema2 = Type.Object({
|
|
84
|
+
from: Type.String(),
|
|
85
|
+
to: Type.String(),
|
|
86
|
+
label: Type.Optional(Type.String()),
|
|
87
|
+
style: Type.Optional(Type.Union([
|
|
88
|
+
Type.Literal("sync"),
|
|
89
|
+
Type.Literal("async"),
|
|
90
|
+
Type.Literal("reply")
|
|
91
|
+
])),
|
|
92
|
+
meta: Type.Optional(MetaSchema2)
|
|
93
|
+
}, { additionalProperties: false });
|
|
94
|
+
var SequenceDocumentSchema2 = Type.Object({
|
|
95
|
+
$schema: Type.Optional(Type.String()),
|
|
96
|
+
version: Type.Literal(FORMAT_VERSION2),
|
|
97
|
+
kind: Type.Literal("sequence"),
|
|
98
|
+
title: Type.Optional(Type.String()),
|
|
99
|
+
participants: Type.Array(ParticipantSchema2, { minItems: 1 }),
|
|
100
|
+
messages: Type.Array(MessageSchema2),
|
|
101
|
+
meta: Type.Optional(MetaSchema2)
|
|
102
|
+
}, { additionalProperties: false });
|
|
103
|
+
var PSEUDO2 = ["initial", "final", "choice", "fork", "join", "history"];
|
|
104
|
+
var StateSchema2 = Type.Object({
|
|
105
|
+
id: Id,
|
|
106
|
+
label: Type.Optional(Type.String()),
|
|
107
|
+
type: Type.Optional(Type.String()),
|
|
108
|
+
pseudo: Type.Optional(Type.Union(PSEUDO2.map((pseudo) => Type.Literal(pseudo)))),
|
|
109
|
+
parent: Type.Optional(Type.String()),
|
|
110
|
+
actions: Type.Optional(Type.Array(Type.String())),
|
|
111
|
+
description: Type.Optional(Type.String()),
|
|
112
|
+
link: Type.Optional(Type.String()),
|
|
113
|
+
meta: Type.Optional(MetaSchema2)
|
|
114
|
+
}, { additionalProperties: false });
|
|
115
|
+
var TransitionSchema2 = Type.Object({
|
|
116
|
+
id: Type.Optional(Id),
|
|
117
|
+
from: Type.String(),
|
|
118
|
+
to: Type.String(),
|
|
119
|
+
event: Type.Optional(Type.String()),
|
|
120
|
+
guard: Type.Optional(Type.String()),
|
|
121
|
+
action: Type.Optional(Type.String()),
|
|
122
|
+
type: Type.Optional(Type.String()),
|
|
123
|
+
meta: Type.Optional(MetaSchema2)
|
|
124
|
+
}, { additionalProperties: false });
|
|
125
|
+
var StateDocumentSchema2 = Type.Object({
|
|
126
|
+
$schema: Type.Optional(Type.String()),
|
|
127
|
+
version: Type.Literal(FORMAT_VERSION2),
|
|
128
|
+
kind: Type.Literal("state"),
|
|
129
|
+
title: Type.Optional(Type.String()),
|
|
130
|
+
direction: Type.Optional(DirectionSchema2),
|
|
131
|
+
states: Type.Array(StateSchema2, { minItems: 1 }),
|
|
132
|
+
transitions: Type.Optional(Type.Array(TransitionSchema2)),
|
|
133
|
+
meta: Type.Optional(MetaSchema2)
|
|
134
|
+
}, { additionalProperties: false });
|
|
135
|
+
var KEYS2 = ["pk", "fk", "uk"];
|
|
136
|
+
var CARDINALITIES3 = ["one", "zero-or-one", "one-or-more", "zero-or-more"];
|
|
137
|
+
var AttributeSchema2 = Type.Object({
|
|
138
|
+
name: Type.String({ minLength: 1 }),
|
|
139
|
+
type: Type.Optional(Type.String()),
|
|
140
|
+
keys: Type.Optional(Type.Array(Type.Union(KEYS2.map((key) => Type.Literal(key))))),
|
|
141
|
+
nullable: Type.Optional(Type.Boolean()),
|
|
142
|
+
note: Type.Optional(Type.String())
|
|
143
|
+
}, { additionalProperties: false });
|
|
144
|
+
var EntitySchema2 = Type.Object({
|
|
145
|
+
id: Id,
|
|
146
|
+
label: Type.Optional(Type.String()),
|
|
147
|
+
type: Type.Optional(Type.String()),
|
|
148
|
+
description: Type.Optional(Type.String()),
|
|
149
|
+
link: Type.Optional(Type.String()),
|
|
150
|
+
attributes: Type.Optional(Type.Array(AttributeSchema2)),
|
|
151
|
+
meta: Type.Optional(MetaSchema2)
|
|
152
|
+
}, { additionalProperties: false });
|
|
153
|
+
var CardinalitySchema = Type.Union(CARDINALITIES3.map((cardinality) => Type.Literal(cardinality)));
|
|
154
|
+
var RelationSchema2 = Type.Object({
|
|
155
|
+
id: Type.Optional(Id),
|
|
156
|
+
from: Type.String(),
|
|
157
|
+
to: Type.String(),
|
|
158
|
+
fromCardinality: Type.Optional(CardinalitySchema),
|
|
159
|
+
toCardinality: Type.Optional(CardinalitySchema),
|
|
160
|
+
label: Type.Optional(Type.String()),
|
|
161
|
+
identifying: Type.Optional(Type.Boolean()),
|
|
162
|
+
type: Type.Optional(Type.String()),
|
|
163
|
+
meta: Type.Optional(MetaSchema2)
|
|
164
|
+
}, { additionalProperties: false });
|
|
165
|
+
var ErDocumentSchema2 = Type.Object({
|
|
166
|
+
$schema: Type.Optional(Type.String()),
|
|
167
|
+
version: Type.Literal(FORMAT_VERSION2),
|
|
168
|
+
kind: Type.Literal("er"),
|
|
169
|
+
title: Type.Optional(Type.String()),
|
|
170
|
+
direction: Type.Optional(DirectionSchema2),
|
|
171
|
+
entities: Type.Array(EntitySchema2, { minItems: 1 }),
|
|
172
|
+
relations: Type.Optional(Type.Array(RelationSchema2)),
|
|
173
|
+
meta: Type.Optional(MetaSchema2)
|
|
174
|
+
}, { additionalProperties: false });
|
|
175
|
+
var TREE_LAYOUTS2 = ["tree", "mindmap"];
|
|
176
|
+
var TreeNodeSchema2 = Type.Object({
|
|
177
|
+
id: Id,
|
|
178
|
+
label: Type.String(),
|
|
179
|
+
parent: Type.Optional(Type.String()),
|
|
180
|
+
type: Type.Optional(Type.String()),
|
|
181
|
+
shape: Type.Optional(ShapeSchema2),
|
|
182
|
+
description: Type.Optional(Type.String()),
|
|
183
|
+
link: Type.Optional(Type.String()),
|
|
184
|
+
meta: Type.Optional(MetaSchema2)
|
|
185
|
+
}, { additionalProperties: false });
|
|
186
|
+
var TreeDocumentSchema2 = Type.Object({
|
|
187
|
+
$schema: Type.Optional(Type.String()),
|
|
188
|
+
version: Type.Literal(FORMAT_VERSION2),
|
|
189
|
+
kind: Type.Literal("tree"),
|
|
190
|
+
title: Type.Optional(Type.String()),
|
|
191
|
+
layout: Type.Optional(Type.Union(TREE_LAYOUTS2.map((layout) => Type.Literal(layout)))),
|
|
192
|
+
direction: Type.Optional(DirectionSchema2),
|
|
193
|
+
nodes: Type.Array(TreeNodeSchema2, { minItems: 1 }),
|
|
194
|
+
meta: Type.Optional(MetaSchema2)
|
|
195
|
+
}, { additionalProperties: false });
|
|
196
|
+
var DocumentSchema2 = Type.Union([
|
|
197
|
+
GraphDocumentSchema2,
|
|
198
|
+
SequenceDocumentSchema2,
|
|
199
|
+
StateDocumentSchema2,
|
|
200
|
+
ErDocumentSchema2,
|
|
201
|
+
TreeDocumentSchema2
|
|
202
|
+
], {
|
|
203
|
+
$id: "urn:standargraph:graph-document:v1",
|
|
204
|
+
title: "Standargraph document v1"
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
export { FORMAT_VERSION2, ProvenanceSchema2, MetaSchema2, SHAPES2, ShapeSchema2, NodeSchema2, EdgeSchema2, GroupSchema2, DirectionSchema2, GraphDocumentSchema2, ParticipantSchema2, MessageSchema2, SequenceDocumentSchema2, PSEUDO2, StateSchema2, TransitionSchema2, StateDocumentSchema2, KEYS2, CARDINALITIES3, AttributeSchema2, EntitySchema2, RelationSchema2, ErDocumentSchema2, TREE_LAYOUTS2, TreeNodeSchema2, TreeDocumentSchema2, DocumentSchema2 };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/format/transition-label.ts
|
|
2
|
+
function transitionLabel2(transition) {
|
|
3
|
+
const { event, guard, action } = transition;
|
|
4
|
+
return [
|
|
5
|
+
event,
|
|
6
|
+
guard === undefined ? undefined : `[${guard}]`,
|
|
7
|
+
action === undefined ? undefined : `/ ${action}`
|
|
8
|
+
].filter((part) => part !== undefined).join(" ");
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { transitionLabel2 };
|