@diagrammo/dgmo 0.8.27 → 0.8.28

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagrammo/dgmo",
3
- "version": "0.8.27",
3
+ "version": "0.8.28",
4
4
  "description": "DGMO diagram markup language — parser, renderer, and color system",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,12 +28,13 @@ function classId(name: string): string {
28
28
  // Regex patterns
29
29
  // ============================================================
30
30
 
31
- // Class declaration: [modifier] ClassName [extends|implements ParentClass] (color)
31
+ // Class declaration: [modifier] ClassName [extends Parent] [implements Interface] (color)
32
32
  // Supports both:
33
33
  // New: `abstract Animal` or `interface Serializable`
34
34
  // Old: `Animal [abstract]` (bracketed suffix, kept for transition)
35
+ // Both `extends` and `implements` may appear together: `Circle extends Shape implements Drawable`.
35
36
  const CLASS_DECL_RE =
36
- /^(?:(abstract|interface|enum)\s+)?([A-Z][A-Za-z0-9_]*)(?:\s+(extends|implements)\s+([A-Z][A-Za-z0-9_]*))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+\(([^)]+)\))?\s*$/;
37
+ /^(?:(abstract|interface|enum)\s+)?([A-Z][A-Za-z0-9_]*)(?:\s+extends\s+([A-Z][A-Za-z0-9_]*))?(?:\s+implements\s+([A-Z][A-Za-z0-9_]*))?(?:\s+\[(abstract|interface|enum)\])?(?:\s+\(([^)]+)\))?\s*$/;
37
38
 
38
39
  // Relationship — arrow syntax (indented under source class):
39
40
  // --|> TargetClass label (space-separated)
@@ -303,8 +304,8 @@ export function parseClassDiagram(
303
304
  if (classDecl) {
304
305
  const prefixModifier = classDecl[1] as ClassModifier | undefined;
305
306
  const name = classDecl[2];
306
- const relKeyword = classDecl[3] as 'extends' | 'implements' | undefined;
307
- const parentName = classDecl[4];
307
+ const extendsParent = classDecl[3];
308
+ const implementsInterface = classDecl[4];
308
309
  const bracketModifier = classDecl[5] as ClassModifier | undefined;
309
310
  const modifier = prefixModifier ?? bracketModifier;
310
311
  const colorName = classDecl[6]?.trim();
@@ -323,13 +324,25 @@ export function parseClassDiagram(
323
324
  // Update line number to the declaration line (may have been created by relationship)
324
325
  node.lineNumber = lineNumber;
325
326
 
326
- // Inline extends/implements creates a relationship
327
- if (relKeyword && parentName) {
328
- getOrCreateClass(parentName, lineNumber);
327
+ // Inline extends creates an extends relationship
328
+ if (extendsParent) {
329
+ getOrCreateClass(extendsParent, lineNumber);
329
330
  result.relationships.push({
330
331
  source: classId(name),
331
- target: classId(parentName),
332
- type: relKeyword as RelationshipType,
332
+ target: classId(extendsParent),
333
+ type: 'extends',
334
+ lineNumber,
335
+ });
336
+ }
337
+
338
+ // Inline implements creates an implements relationship
339
+ // (may co-occur with extends — Circle extends Shape implements Drawable)
340
+ if (implementsInterface) {
341
+ getOrCreateClass(implementsInterface, lineNumber);
342
+ result.relationships.push({
343
+ source: classId(name),
344
+ target: classId(implementsInterface),
345
+ type: 'implements',
333
346
  lineNumber,
334
347
  });
335
348
  }
package/src/d3.ts CHANGED
@@ -7101,8 +7101,8 @@ export async function renderForExport(
7101
7101
  const radarParsed = parseTechRadar(content);
7102
7102
  if (radarParsed.error || radarParsed.quadrants.length === 0) return '';
7103
7103
 
7104
- const RADAR_EXPORT_W = 1600;
7105
- const RADAR_EXPORT_H = 1200;
7104
+ const RADAR_EXPORT_W = 1300;
7105
+ const RADAR_EXPORT_H = 1500;
7106
7106
  const container = createExportContainer(RADAR_EXPORT_W, RADAR_EXPORT_H);
7107
7107
  renderTechRadarForExport(
7108
7108
  container,