aboutsummaryrefslogtreecommitdiffstats
path: root/subprojects/frontend/src/xtext
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2023-08-26 21:44:58 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2023-08-26 22:01:33 +0200
commita49083f31679c47e1685e0cedbc9a40cc8f48fd8 (patch)
treed0702f26342297f54124900ecfc52e04c3e16d6f /subprojects/frontend/src/xtext
parentfeat(frontend): automatic fit zoom (diff)
downloadrefinery-a49083f31679c47e1685e0cedbc9a40cc8f48fd8.tar.gz
refinery-a49083f31679c47e1685e0cedbc9a40cc8f48fd8.tar.zst
refinery-a49083f31679c47e1685e0cedbc9a40cc8f48fd8.zip
refactor(frontent): improve graph drawing
Diffstat (limited to 'subprojects/frontend/src/xtext')
-rw-r--r--subprojects/frontend/src/xtext/xtextServiceResults.ts30
1 files changed, 29 insertions, 1 deletions
diff --git a/subprojects/frontend/src/xtext/xtextServiceResults.ts b/subprojects/frontend/src/xtext/xtextServiceResults.ts
index 12f87b26..caf2cf0b 100644
--- a/subprojects/frontend/src/xtext/xtextServiceResults.ts
+++ b/subprojects/frontend/src/xtext/xtextServiceResults.ts
@@ -126,8 +126,36 @@ export const FormattingResult = DocumentStateResult.extend({
126 126
127export type FormattingResult = z.infer<typeof FormattingResult>; 127export type FormattingResult = z.infer<typeof FormattingResult>;
128 128
129export const NodeMetadata = z.object({
130 name: z.string(),
131 simpleName: z.string(),
132 kind: z.enum(['IMPLICIT', 'INDIVIDUAL', 'NEW']),
133});
134
135export type NodeMetadata = z.infer<typeof NodeMetadata>;
136
137export const RelationMetadata = z.object({
138 name: z.string(),
139 simpleName: z.string(),
140 arity: z.number().nonnegative(),
141 detail: z.union([
142 z.object({ type: z.literal('class'), abstractClass: z.boolean() }),
143 z.object({ type: z.literal('reference'), containment: z.boolean() }),
144 z.object({
145 type: z.literal('opposite'),
146 container: z.boolean(),
147 opposite: z.string(),
148 }),
149 z.object({ type: z.literal('predicate'), error: z.boolean() }),
150 z.object({ type: z.literal('builtin') }),
151 ]),
152});
153
154export type RelationMetadata = z.infer<typeof RelationMetadata>;
155
129export const SemanticsSuccessResult = z.object({ 156export const SemanticsSuccessResult = z.object({
130 nodes: z.string().nullable().array(), 157 nodes: NodeMetadata.array(),
158 relations: RelationMetadata.array(),
131 partialInterpretation: z.record( 159 partialInterpretation: z.record(
132 z.string(), 160 z.string(),
133 z.union([z.number(), z.string()]).array().array(), 161 z.union([z.number(), z.string()]).array().array(),