@diagrammo/dgmo 0.8.26 → 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/dist/cli.cjs +69 -69
- package/dist/index.cjs +21 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -11
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.js.map +1 -1
- package/package.json +1 -1
- package/src/class/parser.ts +22 -9
- package/src/d3.ts +2 -2
- package/src/tech-radar/parser.ts +1 -1
- package/src/tech-radar/renderer.ts +4 -2
package/package.json
CHANGED
package/src/class/parser.ts
CHANGED
|
@@ -28,12 +28,13 @@ function classId(name: string): string {
|
|
|
28
28
|
// Regex patterns
|
|
29
29
|
// ============================================================
|
|
30
30
|
|
|
31
|
-
// Class declaration: [modifier] ClassName [extends
|
|
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+(
|
|
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
|
|
307
|
-
const
|
|
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
|
|
327
|
-
if (
|
|
328
|
-
getOrCreateClass(
|
|
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(
|
|
332
|
-
type:
|
|
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 =
|
|
7105
|
-
const RADAR_EXPORT_H =
|
|
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,
|
package/src/tech-radar/parser.ts
CHANGED
|
@@ -33,7 +33,7 @@ const POSITION_ORDER: readonly QuadrantPosition[] = [
|
|
|
33
33
|
/** Known tech-radar options (key-value). */
|
|
34
34
|
const KNOWN_OPTIONS = new Set<string>([]);
|
|
35
35
|
/** Known tech-radar boolean options (bare keyword). */
|
|
36
|
-
const KNOWN_BOOLEANS = new Set<string>([]);
|
|
36
|
+
const KNOWN_BOOLEANS = new Set<string>(['show-blip-legend']);
|
|
37
37
|
|
|
38
38
|
export function parseTechRadar(content: string): ParsedTechRadar {
|
|
39
39
|
const result: ParsedTechRadar = {
|
|
@@ -111,8 +111,10 @@ export function renderTechRadar(
|
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
-
// Determine if listing is visible — always show for export (blip legend is essential)
|
|
115
|
-
|
|
114
|
+
// Determine if listing is visible — always show for export (blip legend is essential).
|
|
115
|
+
// Otherwise: runtime option wins; falls back to the `show-blip-legend` directive in source.
|
|
116
|
+
const directiveOn = parsed.options['show-blip-legend'] === 'on';
|
|
117
|
+
const showListing = exportDims ? true : (options?.showListing ?? directiveOn);
|
|
116
118
|
const listingHeight = showListing ? estimateListingHeight(parsed) : 0;
|
|
117
119
|
|
|
118
120
|
const init = initRadarSvg(container, palette, exportDims);
|