sysml-diagram 0.45.0 → 0.45.1
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/out/main.js +105 -5
- package/out/main.js.map +3 -3
- package/package.json +1 -1
- package/resources/sysml.dimension-table.json +1 -1
package/out/main.js
CHANGED
|
@@ -166685,6 +166685,8 @@ function buildDiagramProperties(document2, selection2, context) {
|
|
|
166685
166685
|
if (member)
|
|
166686
166686
|
seen.add(member);
|
|
166687
166687
|
const reference2 = !!member && !contains(owner, member);
|
|
166688
|
+
if (reference2 && owner !== node)
|
|
166689
|
+
continue;
|
|
166688
166690
|
all.push({
|
|
166689
166691
|
node: member,
|
|
166690
166692
|
title: group.title,
|
|
@@ -170867,7 +170869,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
170867
170869
|
redefinitions: propertyRedefinitions,
|
|
170868
170870
|
qualifiedName: (node) => editableQualifiedName(node, true),
|
|
170869
170871
|
owners: (node) => this.inheritedFeatureOwnersOf(node, this.localIndex(ast_utils_exports.getDocument(node).parseResult.value), /* @__PURE__ */ new Set(), propertyRedefinitions),
|
|
170870
|
-
compartments: (node, visit) => this.compartmentsFor(node, uri, this.localIndex(ast_utils_exports.getDocument(node).parseResult.value), true, false, visit) ?? [],
|
|
170872
|
+
compartments: (node, visit) => this.compartmentsFor(node, uri, this.localIndex(ast_utils_exports.getDocument(node).parseResult.value), true, false, visit, true) ?? [],
|
|
170871
170873
|
type: (node) => {
|
|
170872
170874
|
if (node.$type === "AcceptNode")
|
|
170873
170875
|
return node.type?.$refText;
|
|
@@ -171914,10 +171916,20 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
171914
171916
|
/** The semantic target path of a referencing perform/exhibit. Anonymous
|
|
171915
171917
|
* shorthand stores it in `name`/`chainSegs`; the named issue-217 form stores
|
|
171916
171918
|
* it as a `references` relationship after the local occurrence name. */
|
|
171917
|
-
behaviorReferenceSegments(stmt) {
|
|
171919
|
+
behaviorReferenceSegments(stmt, resolver = this.featurePaths) {
|
|
171918
171920
|
const relationships = stmt.relationships ?? [];
|
|
171919
171921
|
const reference = relationships.find((relationship) => (relationship.kind === "references" || relationship.kind === "::>") && (relationship.targets?.length ?? 0) > 0);
|
|
171920
|
-
return reference ?
|
|
171922
|
+
return reference ? resolver.resolvePropertyPath(reference, "targets").segments : resolver.resolveDeclarationPath(stmt).segments;
|
|
171923
|
+
}
|
|
171924
|
+
/** issue #191 — the state an `exhibit` claim names. The document-local walk
|
|
171925
|
+
* answers first; the workspace resolver then follows imports into another
|
|
171926
|
+
* file, which Properties needs and the per-document diagrams do not. */
|
|
171927
|
+
exhibitTargetOf(stmt, index2) {
|
|
171928
|
+
const local = this.performTargetOf(stmt, index2);
|
|
171929
|
+
if (local || !this.shared)
|
|
171930
|
+
return local;
|
|
171931
|
+
const target = this.behaviorReferenceSegments(stmt, this.annotationPathResolver(stmt)).at(-1)?.target;
|
|
171932
|
+
return target && target !== stmt && !this.referencesBehavior(target) ? target : void 0;
|
|
171921
171933
|
}
|
|
171922
171934
|
/** `perform <path>` has no local occurrence name. `perform action <name>`
|
|
171923
171935
|
* does, including the named `references <path>` form used when an explicit
|
|
@@ -172174,6 +172186,92 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
|
|
|
172174
172186
|
cache.performClaims = claims;
|
|
172175
172187
|
return claims;
|
|
172176
172188
|
}
|
|
172189
|
+
/** issue #191 — every `exhibit` claim of one document, by the state it
|
|
172190
|
+
* exhibits. A declaring `exhibit state s : S;` exhibits its own usage; a
|
|
172191
|
+
* referencing `exhibit s;` exhibits the state its path resolves to. A state
|
|
172192
|
+
* definition is also exhibited through the usages it types. */
|
|
172193
|
+
exhibitClaimsByTarget(root4) {
|
|
172194
|
+
const cache = this.perParse(root4);
|
|
172195
|
+
if (cache.exhibitClaims?.epoch === this.indexEpoch)
|
|
172196
|
+
return cache.exhibitClaims.claims;
|
|
172197
|
+
const claims = /* @__PURE__ */ new Map();
|
|
172198
|
+
const index2 = this.localIndex(root4);
|
|
172199
|
+
const push2 = (target, claim) => {
|
|
172200
|
+
const existing = claims.get(target);
|
|
172201
|
+
if (!existing)
|
|
172202
|
+
claims.set(target, [claim]);
|
|
172203
|
+
else if (!existing.includes(claim))
|
|
172204
|
+
existing.push(claim);
|
|
172205
|
+
};
|
|
172206
|
+
for (const node of this.rootContents(root4)) {
|
|
172207
|
+
if (!isExhibitStateDecl(node))
|
|
172208
|
+
continue;
|
|
172209
|
+
const target = this.referencesBehavior(node) ? this.exhibitTargetOf(node, index2) : node;
|
|
172210
|
+
if (!target || target !== node && this.referencesBehavior(target))
|
|
172211
|
+
continue;
|
|
172212
|
+
push2(target, node);
|
|
172213
|
+
const definition = target.isDef === true ? void 0 : this.resolveType(target, index2);
|
|
172214
|
+
if (definition && isStateDecl(definition) && definition.isDef === true)
|
|
172215
|
+
push2(definition, node);
|
|
172216
|
+
}
|
|
172217
|
+
cache.exhibitClaims = { epoch: this.indexEpoch, claims };
|
|
172218
|
+
return claims;
|
|
172219
|
+
}
|
|
172220
|
+
// REQ-182 — Compartment inventory
|
|
172221
|
+
// issue #191 — `exhibit states`, `exhibits`, and `exhibited by`.
|
|
172222
|
+
// The forward rows are the owner's own `exhibit` members: a declaring one is
|
|
172223
|
+
// an exhibit state usage, a referencing one names a state declared elsewhere.
|
|
172224
|
+
// The reverse rows read every workspace document, so a claim in another file
|
|
172225
|
+
// still lists its exhibitor. Rows are sourced from the claim, so each one
|
|
172226
|
+
// opens the exact `exhibit` line even when its target is not drawn.
|
|
172227
|
+
addExhibitCompartments(node, members, index2, uri, add, include) {
|
|
172228
|
+
const exhibits = members.filter((m) => isExhibitStateDecl(m) && include(m));
|
|
172229
|
+
const item = (m, text) => ({ text, source: sourceOf2(m, uri) });
|
|
172230
|
+
add("exhibit states", exhibits.filter((m) => !this.isAnonymousBehaviorReference(m)).map((m) => {
|
|
172231
|
+
const declared = this.featureText(m);
|
|
172232
|
+
if (!this.referencesBehavior(m))
|
|
172233
|
+
return item(m, declared);
|
|
172234
|
+
const referenced = this.behaviorReferenceText(m);
|
|
172235
|
+
const unresolved = this.exhibitTargetOf(m, index2) ? "" : " (unresolved)";
|
|
172236
|
+
return item(m, `${declared} references ${referenced}${unresolved}`);
|
|
172237
|
+
}));
|
|
172238
|
+
add("exhibits", exhibits.filter((m) => this.isAnonymousBehaviorReference(m)).map((m) => {
|
|
172239
|
+
const referenced = this.behaviorReferenceText(m) || this.featureText(m);
|
|
172240
|
+
return item(m, this.exhibitTargetOf(m, index2) ? referenced : `${referenced} (unresolved)`);
|
|
172241
|
+
}));
|
|
172242
|
+
if (!isStateDecl(node) && !isExhibitStateDecl(node))
|
|
172243
|
+
return;
|
|
172244
|
+
const roots = /* @__PURE__ */ new Set([this.documentRootOf(node)]);
|
|
172245
|
+
for (const document2 of this.shared?.workspace.LangiumDocuments.all ?? []) {
|
|
172246
|
+
if (isLibraryDocument(document2))
|
|
172247
|
+
continue;
|
|
172248
|
+
const root4 = document2.parseResult?.value;
|
|
172249
|
+
if (root4)
|
|
172250
|
+
roots.add(root4);
|
|
172251
|
+
}
|
|
172252
|
+
const scope = qnameOf(this.packageScopeOf(node));
|
|
172253
|
+
const exhibitorName = (owner) => {
|
|
172254
|
+
const qualified = qnameOf(owner);
|
|
172255
|
+
if (!qualified)
|
|
172256
|
+
return nameOf3(owner) ?? "?";
|
|
172257
|
+
return scope && qualified.startsWith(`${scope}::`) ? qualified.slice(scope.length + 2) : qualified;
|
|
172258
|
+
};
|
|
172259
|
+
const rows = [];
|
|
172260
|
+
const seen = /* @__PURE__ */ new Set();
|
|
172261
|
+
for (const root4 of roots)
|
|
172262
|
+
for (const claim of this.exhibitClaimsByTarget(root4).get(node) ?? []) {
|
|
172263
|
+
const owner = this.declaringOwnerOf(claim);
|
|
172264
|
+
if (!owner || owner === node)
|
|
172265
|
+
continue;
|
|
172266
|
+
const text = exhibitorName(owner);
|
|
172267
|
+
if (seen.has(text))
|
|
172268
|
+
continue;
|
|
172269
|
+
seen.add(text);
|
|
172270
|
+
const claimUri = ast_utils_exports.getDocument(claim).uri.toString();
|
|
172271
|
+
rows.push({ text, source: sourceOf2(claim === node ? owner : claim, claimUri) });
|
|
172272
|
+
}
|
|
172273
|
+
add("exhibited by", rows);
|
|
172274
|
+
}
|
|
172177
172275
|
isSwimlaneClaim(member, index2) {
|
|
172178
172276
|
if (member.$type !== "PerformStmt")
|
|
172179
172277
|
return false;
|
|
@@ -179549,7 +179647,7 @@ ${bodySource.$cstNode.text}` : declarationText;
|
|
|
179549
179647
|
}
|
|
179550
179648
|
return inherited;
|
|
179551
179649
|
}
|
|
179552
|
-
compartmentsFor(node, uri, index2, featureRows = false, includeInherited = true, visitTitle) {
|
|
179650
|
+
compartmentsFor(node, uri, index2, featureRows = false, includeInherited = true, visitTitle, propertiesOnly = false) {
|
|
179553
179651
|
const writtenMembers = membersOf(node);
|
|
179554
179652
|
const members = writtenMembers.map((m) => this.thenActionMemberNode(m) ?? m);
|
|
179555
179653
|
const n = node;
|
|
@@ -179717,6 +179815,8 @@ ${bodySource.$cstNode.text}` : declarationText;
|
|
|
179717
179815
|
return true;
|
|
179718
179816
|
}));
|
|
179719
179817
|
}
|
|
179818
|
+
if (propertiesOnly)
|
|
179819
|
+
this.addExhibitCompartments(node, members, index2, uri, add, isNonVariantMember);
|
|
179720
179820
|
add("concerns", usages(isConcernDecl).map((m) => item(m)));
|
|
179721
179821
|
add("viewpoints", usages(isViewpointDecl).map((m) => item(m)));
|
|
179722
179822
|
add("exposes", members.filter((m) => m.$type === "ExposeMember").flatMap((m) => (m.paths ?? []).map((path10) => item(path10, this.featurePath(path10) ?? (path10.$cstNode?.text ?? "").replace(/\s+/g, " ").trim()))));
|
|
@@ -222697,7 +222797,7 @@ async function runExport(command) {
|
|
|
222697
222797
|
}
|
|
222698
222798
|
|
|
222699
222799
|
// src/main.ts
|
|
222700
|
-
var VERSION2 = true ? "0.45.
|
|
222800
|
+
var VERSION2 = true ? "0.45.1" : "dev";
|
|
222701
222801
|
function display(file) {
|
|
222702
222802
|
const rel2 = path9.relative(process.cwd(), file);
|
|
222703
222803
|
return rel2 && !rel2.startsWith("..") ? rel2.split(path9.sep).join("/") : file;
|