sysml-diagram 0.31.0 → 0.31.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 CHANGED
@@ -162534,6 +162534,26 @@ function isPublic(node) {
162534
162534
  return true;
162535
162535
  }
162536
162536
  var SPECIALIZATION_KINDS = /* @__PURE__ */ new Set([":>", ":>>", "specializes", "subsets", "redefines"]);
162537
+ var inheritanceByNode = /* @__PURE__ */ new WeakMap();
162538
+ function inheritanceSyntax(node) {
162539
+ const cached = inheritanceByNode.get(node);
162540
+ if (cached)
162541
+ return cached;
162542
+ const shape = node;
162543
+ const relationships = [...shape.preRelationships ?? [], ...shape.relationships ?? []].filter((relation) => relation.kind && SPECIALIZATION_KINDS.has(relation.kind));
162544
+ const implicitVariant = implicitVariantSpecialization(node)?.target;
162545
+ const externalVariant = !!externalVariantPath(node);
162546
+ const enumUsage = node.$type === "EnumDecl" && shape.isDef !== true;
162547
+ const result = {
162548
+ relationships,
162549
+ implicitVariant,
162550
+ externalVariant,
162551
+ enumUsage,
162552
+ hasSources: !!shape.typing || relationships.length > 0 || !!implicitVariant || externalVariant || enumUsage
162553
+ };
162554
+ inheritanceByNode.set(node, result);
162555
+ return result;
162556
+ }
162537
162557
  function nameOf(node) {
162538
162558
  if (node) {
162539
162559
  const external = externalVariantName(node);
@@ -163168,6 +163188,9 @@ var FeaturePathResolver = class {
163168
163188
  return {};
163169
163189
  }
163170
163190
  typedAndSpecializedOwners(node, snapshot) {
163191
+ const syntax = inheritanceSyntax(node);
163192
+ if (!syntax.hasSources)
163193
+ return [];
163171
163194
  const result = [];
163172
163195
  const seen = /* @__PURE__ */ new Set();
163173
163196
  const visit = (candidate) => {
@@ -163175,15 +163198,20 @@ var FeaturePathResolver = class {
163175
163198
  return;
163176
163199
  seen.add(candidate);
163177
163200
  result.push(candidate);
163178
- visit(this.externalVariantTarget(candidate));
163179
- visit(implicitVariantSpecialization(candidate)?.target);
163201
+ const inheritedSyntax = inheritanceSyntax(candidate);
163202
+ if (!inheritedSyntax.hasSources)
163203
+ return;
163204
+ if (inheritedSyntax.externalVariant)
163205
+ visit(this.externalVariantTarget(candidate));
163206
+ visit(inheritedSyntax.implicitVariant);
163180
163207
  visit(this.inferredEnumerationTarget(candidate));
163181
163208
  visit(this.isEnumUsage(candidate) ? this.enumerationTypingTarget(candidate) : this.typingTarget(candidate, snapshot));
163182
163209
  for (const specialized of this.specializationTargets(candidate, snapshot))
163183
163210
  visit(specialized);
163184
163211
  };
163185
- visit(this.externalVariantTarget(node));
163186
- visit(implicitVariantSpecialization(node)?.target);
163212
+ if (syntax.externalVariant)
163213
+ visit(this.externalVariantTarget(node));
163214
+ visit(syntax.implicitVariant);
163187
163215
  visit(this.inferredEnumerationTarget(node));
163188
163216
  const enumNode = node;
163189
163217
  if (this.enumerationPathDepth === 0 && enumNode.$type === "EnumDecl" && enumNode.isDef !== true && enumNode.value?.$type === "PathExpr" && isEnumerationUsage(enumNode)) {
@@ -163253,15 +163281,13 @@ var FeaturePathResolver = class {
163253
163281
  return typed;
163254
163282
  }
163255
163283
  specializationTargets(node, snapshot) {
163256
- if (this.resolvingSpecializations.has(node))
163284
+ const { relationships } = inheritanceSyntax(node);
163285
+ if (relationships.length === 0 || this.resolvingSpecializations.has(node))
163257
163286
  return [];
163258
163287
  this.resolvingSpecializations.add(node);
163259
- const relNode = node;
163260
163288
  const result = [];
163261
163289
  try {
163262
- for (const relation of [...relNode.preRelationships ?? [], ...relNode.relationships ?? []]) {
163263
- if (!relation.kind || !SPECIALIZATION_KINDS.has(relation.kind))
163264
- continue;
163290
+ for (const relation of relationships) {
163265
163291
  for (const [index2, target] of (relation.targets ?? []).entries()) {
163266
163292
  const simple = simpleRelationName(target);
163267
163293
  const scoped = simple ? this.scopedSpecializationTarget(node, simple, snapshot) : void 0;
@@ -167203,7 +167229,7 @@ var SysmlDiagramModelProvider = class _SysmlDiagramModelProvider {
167203
167229
  multiplicity: this.multText(n2),
167204
167230
  type: typeText(n2) ?? (usageDefinitions.get(n2) ? nameOf2(usageDefinitions.get(n2)) : void 0),
167205
167231
  ...attributeUsages.has(n2) ? { value: attributeValue(n2) } : {},
167206
- compartments: this.compartmentsFor(n2, uri, index2, shape === "box"),
167232
+ compartments: extra?.compartments ?? this.compartmentsFor(n2, uri, index2, shape === "box"),
167207
167233
  ...packageOf2(n2),
167208
167234
  source: sourceOf2(n2, uri),
167209
167235
  ...extra
@@ -209598,7 +209624,7 @@ async function runExport(command) {
209598
209624
  }
209599
209625
 
209600
209626
  // src/main.ts
209601
- var VERSION2 = true ? "0.31.0" : "dev";
209627
+ var VERSION2 = true ? "0.31.1" : "dev";
209602
209628
  function display(file) {
209603
209629
  const rel2 = path9.relative(process.cwd(), file);
209604
209630
  return rel2 && !rel2.startsWith("..") ? rel2.split(path9.sep).join("/") : file;