Added rendering and documentation for treemap - linting

This commit is contained in:
Knut Sveidqvist
2025-05-12 15:54:06 +02:00
parent f0c3dfe3b3
commit 2746bccef3
4 changed files with 1 additions and 19 deletions

View File

@@ -58,8 +58,6 @@ const addClass = (id: string, _style: string) => {
if (style) {
style.forEach((s) => {
if (isLabelStyle(s)) {
console.debug('isLabelStyle', s);
// const newStyle = s.replace('fill', 'bgFill'); // .replace('color', 'fill');
if (styleClass?.textStyles) {
styleClass.textStyles.push(s);
} else {
@@ -74,12 +72,6 @@ const addClass = (id: string, _style: string) => {
});
}
// classes.forEach((value) => {
// if (value.cssClasses.includes(id)) {
// value.styles.push(...style.flatMap((s) => s.split(',')));
// }
// });
classes.set(id, styleClass);
};
const getClasses = (): Map<string, DiagramStyleClassDef> => {

View File

@@ -7,7 +7,6 @@ import type {
const id = 'treemap';
const detector: DiagramDetector = (txt) => {
console.log('treemap detector', txt);
return /^\s*treemap/.test(txt);
};

View File

@@ -17,8 +17,6 @@ const populate = (ast: any) => {
// Extract classes and styles from the treemap
for (const row of ast.TreemapRows || []) {
const item = row.item;
if (row.$type === 'ClassDefStatement') {
db.addClass(row.className, row.styleText);
}
@@ -43,7 +41,7 @@ const populate = (ast: any) => {
classSelector: item.classSelector,
cssCompiledStyles: item.classSelector ? db.getStylesForClass(item.classSelector) : undefined,
};
console.debug('itemData', item.$type);
items.push(itemData);
}
@@ -61,11 +59,6 @@ const populate = (ast: any) => {
};
addNodesRecursively(hierarchyNodes, 0);
console.debug('ast.ClassDefStatement', ast);
// Extract data from each classdefintion in the treemap
log.debug('Processed items:', items);
};
/**

View File

@@ -104,8 +104,6 @@ describe('Treemap Parser', () => {
it('should parse a classDef statement', () => {
const result = parse('treemap\nclassDef myClass fill:red;');
console.debug(result.value);
// We know there are parser errors with styleText as the Langium grammar can't handle it perfectly
// Check that we at least got the right type and className
expect(result.value.TreemapRows).toHaveLength(1);