mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-19 04:04:28 +01:00
Merge branch 'develop' into 6638-sequence-diagram-additional-messages
This commit is contained in:
@@ -38,3 +38,5 @@ Each user journey is split into sections, these describe the part of the task
|
|||||||
the user is trying to complete.
|
the user is trying to complete.
|
||||||
|
|
||||||
Tasks syntax is `Task name: <score>: <comma separated list of actors>`
|
Tasks syntax is `Task name: <score>: <comma separated list of actors>`
|
||||||
|
|
||||||
|
Score is a number between 1 and 5, inclusive.
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export class MindmapDB {
|
|||||||
private nodes: MindmapNode[] = [];
|
private nodes: MindmapNode[] = [];
|
||||||
private count = 0;
|
private count = 0;
|
||||||
private elements: Record<number, D3Element> = {};
|
private elements: Record<number, D3Element> = {};
|
||||||
|
private baseLevel?: number;
|
||||||
public readonly nodeType: typeof nodeType;
|
public readonly nodeType: typeof nodeType;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -54,6 +55,7 @@ export class MindmapDB {
|
|||||||
this.nodes = [];
|
this.nodes = [];
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
this.elements = {};
|
this.elements = {};
|
||||||
|
this.baseLevel = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getParent(level: number): MindmapNode | null {
|
public getParent(level: number): MindmapNode | null {
|
||||||
@@ -72,6 +74,17 @@ export class MindmapDB {
|
|||||||
public addNode(level: number, id: string, descr: string, type: number): void {
|
public addNode(level: number, id: string, descr: string, type: number): void {
|
||||||
log.info('addNode', level, id, descr, type);
|
log.info('addNode', level, id, descr, type);
|
||||||
|
|
||||||
|
let isRoot = false;
|
||||||
|
|
||||||
|
if (this.nodes.length === 0) {
|
||||||
|
this.baseLevel = level;
|
||||||
|
level = 0;
|
||||||
|
isRoot = true;
|
||||||
|
} else if (this.baseLevel !== undefined) {
|
||||||
|
level = level - this.baseLevel;
|
||||||
|
isRoot = false;
|
||||||
|
}
|
||||||
|
|
||||||
const conf = getConfig();
|
const conf = getConfig();
|
||||||
let padding = conf.mindmap?.padding ?? defaultConfig.mindmap.padding;
|
let padding = conf.mindmap?.padding ?? defaultConfig.mindmap.padding;
|
||||||
|
|
||||||
@@ -92,6 +105,7 @@ export class MindmapDB {
|
|||||||
children: [],
|
children: [],
|
||||||
width: conf.mindmap?.maxNodeWidth ?? defaultConfig.mindmap.maxNodeWidth,
|
width: conf.mindmap?.maxNodeWidth ?? defaultConfig.mindmap.maxNodeWidth,
|
||||||
padding,
|
padding,
|
||||||
|
isRoot,
|
||||||
};
|
};
|
||||||
|
|
||||||
const parent = this.getParent(level);
|
const parent = this.getParent(level);
|
||||||
@@ -99,7 +113,7 @@ export class MindmapDB {
|
|||||||
parent.children.push(node);
|
parent.children.push(node);
|
||||||
this.nodes.push(node);
|
this.nodes.push(node);
|
||||||
} else {
|
} else {
|
||||||
if (this.nodes.length === 0) {
|
if (isRoot) {
|
||||||
this.nodes.push(node);
|
this.nodes.push(node);
|
||||||
} else {
|
} else {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
@@ -204,8 +218,7 @@ export class MindmapDB {
|
|||||||
// Build CSS classes for the node
|
// Build CSS classes for the node
|
||||||
const cssClasses = ['mindmap-node'];
|
const cssClasses = ['mindmap-node'];
|
||||||
|
|
||||||
// Add section-specific classes
|
if (node.isRoot === true) {
|
||||||
if (node.level === 0) {
|
|
||||||
// Root node gets special classes
|
// Root node gets special classes
|
||||||
cssClasses.push('section-root', 'section--1');
|
cssClasses.push('section-root', 'section--1');
|
||||||
} else if (node.section !== undefined) {
|
} else if (node.section !== undefined) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ export interface MindmapNode {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
x?: number;
|
x?: number;
|
||||||
y?: number;
|
y?: number;
|
||||||
|
isRoot?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FilledMindMapNode = RequiredDeep<MindmapNode>;
|
export type FilledMindMapNode = RequiredDeep<MindmapNode>;
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
import mermaid, { type MermaidConfig } from 'mermaid';
|
import mermaid, { type MermaidConfig } from 'mermaid';
|
||||||
import zenuml from '../../../../../mermaid-zenuml/dist/mermaid-zenuml.core.mjs';
|
import zenuml from '../../../../../mermaid-zenuml/dist/mermaid-zenuml.core.mjs';
|
||||||
|
import tidyTreeLayout from '../../../../../mermaid-layout-tidy-tree/dist/mermaid-layout-tidy-tree.core.mjs';
|
||||||
|
import layouts from '../../../../../mermaid-layout-elk/dist/mermaid-layout-elk.core.mjs';
|
||||||
|
|
||||||
const init = mermaid.registerExternalDiagrams([zenuml]);
|
const init = Promise.all([
|
||||||
|
mermaid.registerExternalDiagrams([zenuml]),
|
||||||
|
mermaid.registerLayoutLoaders(layouts),
|
||||||
|
mermaid.registerLayoutLoaders(tidyTreeLayout),
|
||||||
|
]);
|
||||||
mermaid.registerIconPacks([
|
mermaid.registerIconPacks([
|
||||||
{
|
{
|
||||||
name: 'logos',
|
name: 'logos',
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
"pathe": "^2.0.3",
|
"pathe": "^2.0.3",
|
||||||
"unocss": "^66.4.2",
|
"unocss": "^66.4.2",
|
||||||
"unplugin-vue-components": "^28.4.0",
|
"unplugin-vue-components": "^28.4.0",
|
||||||
"vite": "^6.1.1",
|
"vite": "^7.0.0",
|
||||||
"vite-plugin-pwa": "^1.0.0",
|
"vite-plugin-pwa": "^1.0.0",
|
||||||
"vitepress": "1.6.3",
|
"vitepress": "1.6.3",
|
||||||
"workbox-window": "^7.3.0"
|
"workbox-window": "^7.3.0"
|
||||||
|
|||||||
@@ -20,3 +20,5 @@ Each user journey is split into sections, these describe the part of the task
|
|||||||
the user is trying to complete.
|
the user is trying to complete.
|
||||||
|
|
||||||
Tasks syntax is `Task name: <score>: <comma separated list of actors>`
|
Tasks syntax is `Task name: <score>: <comma separated list of actors>`
|
||||||
|
|
||||||
|
Score is a number between 1 and 5, inclusive.
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ const virtualModuleId = 'virtual:mermaid-config';
|
|||||||
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
build: {
|
||||||
|
// Vite v7 changes the default target and drops old browser support
|
||||||
|
target: 'modules',
|
||||||
|
},
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
// vitepress is aliased with replacement `join(DIST_CLIENT_PATH, '/index')`
|
// vitepress is aliased with replacement `join(DIST_CLIENT_PATH, '/index')`
|
||||||
// This needs to be excluded from optimization
|
// This needs to be excluded from optimization
|
||||||
|
|||||||
1965
pnpm-lock.yaml
generated
1965
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user