{ "version": 3, "sources": ["../../../src/diagrams/eventmodeling/types.ts", "../../../src/diagrams/eventmodeling/db.ts", "../../../src/diagrams/eventmodeling/parser.ts", "../../../src/diagrams/eventmodeling/renderer.ts", "../../../src/diagrams/eventmodeling/styles.js", "../../../src/diagrams/eventmodeling/diagram.ts"], "sourcesContent": ["import type { EventModelingDiagramConfig } from '../../config.type.js';\nimport type { DiagramDBBase } from '../../diagram-api/types.js';\n\nimport type { EmFrame, EventModel } from '@mermaid-js/parser';\n\nexport interface EventModelingDB extends DiagramDBBase {\n setOptions: (rawOptString: string) => void;\n getOptions: () => any;\n\n setAst: (ast: EventModel) => void;\n\n getDiagramProps: () => DiagramProps;\n getState: () => Context;\n}\n\nexport interface DiagramProps {\n swimlaneMinHeight: number;\n swimlanePadding: number;\n swimlaneGap: number;\n boxPadding: number;\n boxOverlap: number;\n boxDefaultY: number;\n boxMinWidth: number;\n boxMaxWidth: number;\n boxMinHeight: number;\n boxMaxHeight: number;\n contentStartX: number;\n textMaxWidth: number;\n boxTextFontWeight: string;\n boxTextPadding: number;\n swimlaneTextFontWeight: string;\n labelUiAutomation: string;\n labelUiAutomationPrefix: string;\n labelCommandReadModel: string;\n labelCommandReadModelPrefix: string;\n labelEvents: string;\n labelEventsPrefix: string;\n}\n\n/**\n * Visual\n */\n\nexport interface Dimension {\n width: number;\n height: number;\n}\n\nexport interface Coordinate {\n x: number;\n y: number;\n}\n\nexport type Color = string;\n\nexport interface VisualProps {\n fill: Color;\n stroke: Color;\n}\n\nexport interface TextProps {\n content: string;\n width: number;\n height: number;\n}\n\nexport interface Box {\n r: number;\n x: number;\n /** This has no meaning for the time being. It is calculated from Swimlane.y ATM. */\n y: number;\n dimension: Dimension;\n leftSibling: boolean;\n swimlane: Swimlane;\n visual: VisualProps;\n text: string;\n frame: EmFrame;\n /** Line index */\n index: number;\n}\n\nexport interface SwimlaneProps {\n index: number;\n label: string;\n namespace?: string;\n}\n\nexport type Swimlane = {\n r: number;\n y: number;\n height: number;\n maxHeight: number;\n} & SwimlaneProps;\n\nexport interface Relation {\n visual: VisualProps;\n source: Coordinate;\n target: Coordinate;\n sourceBox: Box;\n targetBox: Box;\n}\n\nexport interface Context {\n boxes: Box[];\n swimlanes: Record;\n relations: Relation[];\n previousFrame?: EmFrame;\n previousSwimlaneNumber?: number;\n maxR: number;\n sortedSwimlanesArray: Swimlane[];\n}\n\n/**\n * Commands & Events\n */\n\nexport const PositionFrameKind = 'position frame';\nexport type PositionFrame = {\n index: number;\n frame: EmFrame;\n textProps: TextProps;\n} & CommandBase;\n\nexport const FramePositionedKind = 'frame positioned';\nexport type FramePositioned = {\n index: number;\n frame: EmFrame;\n visual: VisualProps;\n dimension: Dimension;\n textProps: TextProps;\n} & EventBase;\n\nexport const PositionRelationKind = 'position relation';\nexport type PositionRelation = {\n index: number;\n frame: EmFrame;\n sourceFrame?: EmFrame;\n} & CommandBase;\n\nexport const RelationPositionedKind = 'relation positioned';\nexport type RelationPositioned = {\n index: number;\n frame: EmFrame;\n sourceBox: Box;\n targetBox: Box;\n} & EventBase;\n\n/**\n * Decider & Event Sourcing support\n */\n\nexport type Command = PositionFrame | PositionRelation;\nexport type Event = FramePositioned | RelationPositioned;\nexport interface CommandBase {\n $kind: string;\n}\nexport interface EventBase {\n $kind: string;\n}\n\nexport type DecideFn = (state: Context, command: Command) => Event[];\nexport type EvolveFn = (state: Context, event: Event) => Context;\n\nexport type Deciders = Record;\nexport type Evolvers = Record;\n", "import { log } from '../../logger.js';\nimport { cleanAndMerge } from '../../utils.js';\nimport { wrapLabel, calculateTextDimensions } from '../../utils.js';\nimport { getConfig as commonGetConfig } from '../../config.js';\nimport type { TextDimensionConfig } from '../../types.js';\nimport {\n setAccTitle,\n getAccTitle,\n getAccDescription,\n setAccDescription,\n clear as commonClear,\n setDiagramTitle,\n getDiagramTitle,\n} from '../common/commonDb.js';\nimport { sanitizeText } from '../common/common.js';\n\nimport DEFAULT_CONFIG from '../../defaultConfig.js';\n\nimport type { EventModelingDiagramConfig } from '../../config.type.js';\nimport type { EventModel } from '@mermaid-js/parser';\nimport type { EmFrame, EmDataEntity } from '@mermaid-js/parser';\nimport { isEmResetFrame } from '@mermaid-js/parser';\n\nimport type {\n EventModelingDB,\n Box,\n Relation,\n Swimlane,\n SwimlaneProps,\n VisualProps,\n Command,\n Event,\n Deciders,\n Evolvers,\n Context,\n PositionFrame,\n PositionRelation,\n FramePositioned,\n RelationPositioned,\n TextProps,\n DiagramProps,\n} from './types.js';\nimport {\n PositionFrameKind,\n PositionRelationKind,\n FramePositionedKind,\n RelationPositionedKind,\n} from './types.js';\n\nexport const setOptions = function (_rawOptString: string) {\n log.debug('options str', _rawOptString);\n};\n\nexport const getOptions = function () {\n return {};\n};\n\nexport const clear = function () {\n reset();\n commonClear();\n};\n\nfunction reset(): void {\n store = {};\n}\n\nexport const getDirection = function () {\n return 'LR';\n};\n\nconst DEFAULT_EVENTMODELING_CONFIG: Required =\n DEFAULT_CONFIG.eventmodeling;\nconst getConfig = (): Required => {\n const config = cleanAndMerge({\n ...DEFAULT_EVENTMODELING_CONFIG,\n ...commonGetConfig().eventmodeling,\n });\n return config;\n};\n\ninterface EmStore {\n ast?: EventModel;\n}\n\nlet store: EmStore = {};\n\nfunction getState(): Context {\n let state = initial;\n const { ast } = store;\n const diagramProps = getDiagramProps();\n\n if (!ast) {\n throw new Error('No data for EventModel');\n }\n\n ast.frames.forEach((frame: EmFrame, index: number) => {\n const textProps = calculateTextProps(frame, ast.dataEntities, diagramProps);\n\n state = dispatch(state, {\n $kind: PositionFrameKind,\n index,\n frame,\n textProps,\n });\n\n let sourceFrames = undefined;\n if (hasSourceFrame(frame)) {\n log.debug(`source frame`, frame.sourceFrames);\n sourceFrames = ast.frames.filter((currentFrame: EmFrame) => {\n //@ts-ignore: sf is Reference but Reference is present in 'langium' package not available in `mermaid` package directly. We might want to re-export it from `parser`.\n return frame.sourceFrames.some((sf) => sf.$refText === currentFrame.name);\n });\n\n sourceFrames.forEach((sourceFrame: EmFrame) => {\n state = dispatch(state, {\n $kind: PositionRelationKind,\n index,\n frame,\n sourceFrame,\n });\n });\n } else {\n state = dispatch(state, {\n $kind: PositionRelationKind,\n index,\n frame,\n });\n }\n });\n\n state = {\n ...state,\n sortedSwimlanesArray: sortedSwimlanesArray(state.swimlanes),\n };\n\n return state;\n}\n\nfunction setAst(ast: EventModel) {\n store.ast = ast;\n}\n\nconst diagramProps = {\n swimlaneMinHeight: 70,\n swimlanePadding: 15,\n swimlaneGap: 10,\n boxPadding: 10,\n boxOverlap: 90,\n boxDefaultY: 0,\n boxMinWidth: 80,\n boxMaxWidth: 450,\n boxMinHeight: 80,\n boxMaxHeight: 750,\n contentStartX: 250,\n textMaxWidth: 450 - 2 * 10,\n boxTextFontWeight: 'bold',\n boxTextPadding: 10,\n swimlaneTextFontWeight: 'bold',\n labelUiAutomation: 'UI/Automation',\n labelUiAutomationPrefix: 'UI/A: ',\n labelCommandReadModel: 'Command/Read Model',\n labelCommandReadModelPrefix: 'C/RM: ',\n labelEvents: 'Events',\n labelEventsPrefix: 'Stream: ',\n};\n\nfunction getDiagramProps(): DiagramProps {\n return diagramProps;\n}\n\nconst initial: Context = {\n boxes: [],\n swimlanes: {},\n relations: [],\n maxR: 0,\n sortedSwimlanesArray: [],\n};\n\nfunction extractNamespace(entityIdentifier: string): string | undefined {\n const spl = entityIdentifier.split('.');\n if (spl.length === 2) {\n return spl[0];\n }\n return undefined;\n}\n\nfunction extractName(entityIdentifier: string): string | undefined {\n const spl = entityIdentifier.split('.');\n if (spl.length === 2) {\n return spl[1];\n }\n return entityIdentifier;\n}\n\nfunction findSwimlaneByNamespace(\n swimlanes: Record,\n namespace: string | undefined\n): Swimlane | undefined {\n if (!namespace || namespace.length === 0) {\n return undefined;\n }\n return Object.values(swimlanes).find((swimlane) => swimlane.namespace === namespace);\n}\n\nfunction findNextAvailableIndex(\n swimlanes: Record,\n boundaryMin: number,\n boundaryMax: number\n): number {\n return (\n Math.max(\n boundaryMin,\n ...Object.keys(swimlanes)\n .filter((key) => {\n const index = Number.parseInt(key);\n return index > boundaryMin && index < boundaryMax;\n })\n .map((key) => Number.parseInt(key))\n ) + 1\n );\n}\n\nfunction calculateSwimlaneProps(\n frame: EmFrame,\n swimlanes: Record\n): SwimlaneProps {\n const namespace = extractNamespace(frame.entityIdentifier);\n const sw = findSwimlaneByNamespace(swimlanes, namespace);\n\n switch (frame.modelEntityType) {\n case 'ui':\n case 'pcr':\n case 'processor':\n if (sw) {\n return {\n index: sw.index,\n label: sw.namespace || diagramProps.labelUiAutomation,\n };\n } else if (namespace) {\n return {\n index: findNextAvailableIndex(swimlanes, 0, 100),\n label: diagramProps.labelUiAutomationPrefix + namespace,\n };\n }\n return { index: 0, label: diagramProps.labelUiAutomation };\n case 'rmo':\n case 'readmodel':\n case 'cmd':\n case 'command':\n if (sw) {\n return {\n index: sw.index,\n label: sw.namespace || diagramProps.labelCommandReadModel,\n };\n } else if (namespace) {\n return {\n index: findNextAvailableIndex(swimlanes, 100, 200),\n label: diagramProps.labelCommandReadModelPrefix + namespace,\n };\n }\n return { index: 100, label: diagramProps.labelCommandReadModel };\n case 'evt':\n case 'event':\n default:\n if (sw) {\n return {\n index: sw.index,\n label: sw.namespace || diagramProps.labelEvents,\n };\n } else if (namespace) {\n return {\n index: findNextAvailableIndex(swimlanes, 200, 300),\n label: diagramProps.labelEventsPrefix + namespace,\n };\n }\n return { index: 200, label: diagramProps.labelEvents };\n }\n}\n\nfunction calculateEntityVisualProps(frame: EmFrame): VisualProps {\n const { themeVariables } = commonGetConfig();\n switch (frame.modelEntityType) {\n case 'ui':\n return {\n fill: themeVariables.emUiFill ?? 'white',\n stroke: themeVariables.emUiStroke ?? '#dbdada',\n };\n case 'pcr':\n case 'processor':\n return {\n fill: themeVariables.emProcessorFill ?? '#edb3f6',\n stroke: themeVariables.emProcessorStroke ?? '#b88cbf',\n };\n case 'rmo':\n case 'readmodel':\n return {\n fill: themeVariables.emReadModelFill ?? '#d3f1a2',\n stroke: themeVariables.emReadModelStroke ?? '#a3b732',\n };\n case 'cmd':\n case 'command':\n return {\n fill: themeVariables.emCommandFill ?? '#bcd6fe',\n stroke: themeVariables.emCommandStroke ?? '#679ac3',\n };\n case 'evt':\n case 'event':\n return {\n fill: themeVariables.emEventFill ?? '#ffb778',\n stroke: themeVariables.emEventStroke ?? '#c19a0f',\n };\n default:\n return {\n fill: 'red',\n stroke: 'black',\n };\n }\n}\n\nfunction calculateTextProps(\n frame: EmFrame,\n dataEntities: EmDataEntity[],\n diagramProps: DiagramProps\n): TextProps {\n const config = commonGetConfig();\n const name = sanitizeText(extractName(frame.entityIdentifier) ?? '', config);\n let toHtml: string | undefined;\n\n const wrapLabelConfig = {\n fontSize: 16,\n fontWeight: 700,\n fontFamily: '\"trebuchet ms\", verdana, arial, sans-serif',\n joinWith: '
',\n };\n\n const wrappedName = wrapLabel(name, diagramProps.textMaxWidth, wrapLabelConfig);\n let content = `${wrappedName}`;\n\n if (frame.dataInlineValue) {\n toHtml = frame.dataInlineValue;\n toHtml = toHtml.substring(toHtml.indexOf('{') + 1);\n toHtml = toHtml.substring(0, toHtml.lastIndexOf('}') - 1);\n toHtml = sanitizeText(toHtml, config);\n toHtml = wrapLabel(toHtml, diagramProps.textMaxWidth, wrapLabelConfig);\n toHtml = toHtml.replaceAll(' ', ' ');\n }\n\n if (frame.dataReference) {\n const dataEntity = dataEntities.find(\n (dataEntity) => dataEntity.name === frame.dataReference?.$refText\n );\n\n if (dataEntity) {\n toHtml = dataEntity.dataBlockValue;\n toHtml = toHtml.substring(toHtml.indexOf('{\\n') + 2);\n toHtml = toHtml.substring(0, toHtml.lastIndexOf('}') - 1);\n toHtml = sanitizeText(toHtml, config);\n toHtml = wrapLabel(toHtml, diagramProps.textMaxWidth, wrapLabelConfig);\n toHtml = toHtml.replaceAll(' ', ' ');\n toHtml += `
`;\n }\n }\n\n const hasRenderedData = toHtml !== undefined;\n\n if (hasRenderedData) {\n content += `

${toHtml}`;\n }\n\n const textDimensionConfig: TextDimensionConfig = {\n fontSize: wrapLabelConfig.fontSize,\n fontWeight: wrapLabelConfig.fontWeight,\n fontFamily: wrapLabelConfig.fontFamily,\n };\n const dimensions = calculateTextDimensions(content, textDimensionConfig);\n\n /** this is a temporal workaround until a more complex dimension calculation is in place */\n const calculatedWidthFix = hasRenderedData ? dimensions.width / 3 : dimensions.width;\n\n const props = {\n content,\n width: calculatedWidthFix,\n height: dimensions.height,\n };\n log.debug(`[${frame.name}] ${frame.entityIdentifier} text`, props);\n return props;\n}\n\nfunction decidePositionFrame(state: Context, _command: Command): Event[] {\n const command = _command as PositionFrame;\n\n const visual = calculateEntityVisualProps(command.frame);\n const dimension = {\n width: command.textProps.width + 2 * diagramProps.boxTextPadding,\n height: command.textProps.height + 2 * diagramProps.boxTextPadding,\n };\n\n const event: FramePositioned = {\n $kind: FramePositionedKind,\n frame: command.frame,\n index: command.index,\n visual: visual,\n dimension,\n textProps: command.textProps,\n };\n return [event];\n}\n\nfunction calculateX(\n swimlane: Partial,\n previousSwimlane: Swimlane | undefined,\n lastBox: Box | undefined\n): number {\n // log.debug(`calculateX`, { previousSwimlane,swimlane:event.swimlane,r: swimlane.r,lbr:lastBox?.r});\n if (previousSwimlane === undefined) {\n return diagramProps.contentStartX;\n }\n if (previousSwimlane.index === swimlane.index && swimlane.r) {\n return swimlane.r + diagramProps.boxPadding;\n }\n\n if (lastBox === undefined) {\n return diagramProps.contentStartX;\n }\n\n return lastBox.r - diagramProps.boxOverlap + diagramProps.boxPadding;\n}\n\nfunction calculateMaxRight(swimlanes: Swimlane[], swimlaneR: number): number {\n const rs = [...swimlanes.map((s) => s.r), swimlaneR];\n return Math.max(...rs);\n}\n\nfunction sortedSwimlanesArray(swimlanes: Record): Swimlane[] {\n return Object.values(swimlanes).sort((a, b) => a.index - b.index);\n}\n\nfunction evolveFramePositioned(state: Context, _event: Event): Context {\n const event: FramePositioned = _event as FramePositioned;\n\n const swimlaneProps = calculateSwimlaneProps(event.frame, state.swimlanes);\n\n let swimlane: Swimlane;\n if (swimlaneProps.index in state.swimlanes) {\n swimlane = state.swimlanes[swimlaneProps.index];\n } else {\n swimlane = {\n index: swimlaneProps.index,\n label: swimlaneProps.label,\n r: 0,\n y: swimlaneProps.index * diagramProps.swimlaneMinHeight + diagramProps.swimlaneGap,\n height: diagramProps.swimlaneMinHeight,\n maxHeight: diagramProps.swimlaneMinHeight,\n };\n }\n\n const lastBox = state.boxes.length > 0 ? state.boxes[state.boxes.length - 1] : undefined;\n const previousSwimlane =\n state.previousSwimlaneNumber !== undefined\n ? state.swimlanes[state.previousSwimlaneNumber]\n : undefined;\n\n const dimension = {\n width:\n Math.max(\n diagramProps.boxMinWidth,\n Math.min(diagramProps.boxMaxWidth, event.dimension.width)\n ) +\n 2 * diagramProps.boxPadding,\n height:\n Math.max(\n diagramProps.boxMinHeight,\n Math.min(diagramProps.boxMaxHeight, event.dimension.height)\n ) +\n 2 * diagramProps.boxPadding,\n };\n\n const x = calculateX(swimlane, previousSwimlane, lastBox);\n const r = x + dimension.width + diagramProps.boxPadding;\n const maxR = calculateMaxRight(Object.values(state.swimlanes), r);\n\n swimlane.r = x + dimension.width;\n swimlane.maxHeight = Math.max(swimlane.maxHeight, dimension.height);\n swimlane.height =\n Math.max(diagramProps.swimlaneMinHeight, swimlane.maxHeight) + 2 * diagramProps.swimlanePadding;\n\n const box: Box = {\n x,\n y: diagramProps.swimlanePadding + swimlane.y,\n // y: diagramProps.swimlanePadding + (swimlane.y || diagramProps.boxDefaultY),\n r,\n dimension,\n leftSibling: false,\n swimlane: swimlane,\n visual: event.visual,\n text: event.textProps.content,\n frame: event.frame,\n index: event.index,\n };\n\n const newState = {\n ...state,\n boxes: [...state.boxes, box],\n swimlanes: {\n ...state.swimlanes,\n [`${swimlane.index}`]: swimlane,\n },\n previousSwimlaneNumber: swimlaneProps.index,\n previousFrame: event.frame,\n maxR,\n };\n\n /** the following swimlane.y recalculation is suboptimal. Additionally\n * the value of Box.y is not taken into account in rendering time.\n * This is fine for the time being, but maybe needs improvement later on.\n */\n const swimlanes = sortedSwimlanesArray(newState.swimlanes);\n if (swimlanes.length > 0) {\n swimlanes[0].y = 0;\n }\n for (let i = 1; i < swimlanes.length; i++) {\n const sw = swimlanes[i];\n const prevSw = swimlanes[i - 1];\n\n sw.y = prevSw.y + prevSw.height + diagramProps.swimlaneGap;\n }\n\n return newState;\n}\n\nfunction isFirstFrame(index: number, frame: EmFrame): boolean {\n if (index === 0 && frame.sourceFrames.length === 0) {\n return true;\n }\n return false;\n}\n\nfunction hasSourceFrame(frame: EmFrame): boolean {\n return (\n frame.sourceFrames !== undefined && frame.sourceFrames !== null && frame.sourceFrames.length > 0\n );\n}\n\nfunction findBoxByFrame(boxes: Box[], frame: EmFrame | undefined): Box | undefined {\n if (frame === undefined || frame === null) {\n return undefined;\n }\n return boxes.find((box) => box.frame.name === frame.name);\n}\n\nfunction findBoxByLineIndex(\n boxes: Box[],\n targetSwimlane: number,\n lineIndex: number\n): Box | undefined {\n if (lineIndex < 0) {\n return undefined;\n }\n\n // boxes.find((box) => box.index === lineIndex);\n for (let i = lineIndex; i >= 0; i--) {\n const box = boxes[i];\n if (box.swimlane.index !== targetSwimlane) {\n return box;\n }\n }\n return undefined;\n}\n\nfunction decidePositionRelation(state: Context, _command: Command): Event[] {\n const command = _command as PositionRelation;\n\n if (isEmResetFrame(command.frame) || isFirstFrame(command.index, command.frame)) {\n return [];\n }\n\n const targetBox = findBoxByFrame(state.boxes, command.frame);\n\n if (targetBox === undefined) {\n throw new Error(`Target box not found for frame ${command.frame.name}`);\n }\n\n let sourceBox;\n if (command.sourceFrame) {\n sourceBox = findBoxByFrame(state.boxes, command.sourceFrame);\n } else {\n sourceBox = findBoxByLineIndex(state.boxes, targetBox.swimlane.index, command.index - 1);\n }\n\n if (sourceBox === undefined) {\n // Source box not found for frame ${command.frame.name}\n return [];\n }\n const event: RelationPositioned = {\n $kind: RelationPositionedKind,\n frame: command.frame,\n index: command.index,\n sourceBox,\n targetBox,\n };\n return [event];\n}\n\nfunction evolveRelationPositioned(state: Context, _event: Event): Context {\n const event = _event as RelationPositioned;\n\n const relation: Relation = {\n visual: {\n fill: 'none',\n stroke: '#000',\n },\n source: {\n x: event.sourceBox.x,\n y: event.sourceBox.y,\n },\n target: {\n x: event.targetBox.x,\n y: event.targetBox.y,\n },\n sourceBox: event.sourceBox,\n targetBox: event.targetBox,\n };\n\n const newState = {\n ...state,\n relations: [...state.relations, relation],\n };\n return newState;\n}\n\nconst deciders: Deciders = {\n [PositionFrameKind]: decidePositionFrame,\n [PositionRelationKind]: decidePositionRelation,\n};\n\nconst evolvers: Evolvers = {\n [FramePositionedKind]: evolveFramePositioned,\n [RelationPositionedKind]: evolveRelationPositioned,\n};\n\nfunction decide(state: Context, command: Command): Event[] {\n const fn = deciders[command.$kind];\n if (fn === undefined || fn === null) {\n return [];\n }\n\n const events = fn(state, command);\n log.debug(`decided events`, events);\n return events;\n}\n\nfunction evolve(state: Context, events: Event[]): Context {\n const newState = events.reduce((previousState, event) => {\n const fn = evolvers[event.$kind];\n if (fn === undefined || fn === null) {\n return previousState;\n }\n return fn(previousState, event);\n }, state);\n log.debug(`evolve events`, { state, newState, events });\n return newState;\n}\n\nfunction dispatch(state: Context, command: Command): Context {\n const events = decide(state, command);\n const newState = evolve(state, events);\n return newState;\n}\n\nexport const db: EventModelingDB = {\n getConfig,\n\n setOptions,\n getOptions,\n clear,\n\n setAccTitle,\n getAccTitle,\n getAccDescription,\n setAccDescription,\n setDiagramTitle,\n getDiagramTitle,\n\n setAst,\n\n getDiagramProps,\n getState,\n};\n", "import type { EventModel } from '@mermaid-js/parser';\nimport { parse } from '@mermaid-js/parser';\nimport type { ParserDefinition } from '../../diagram-api/types.js';\nimport { log } from '../../logger.js';\nimport { populateCommonDb } from '../common/populateCommonDb.js';\nimport { db } from './db.js';\n\nexport const parser: ParserDefinition = {\n parse: async (input: string): Promise => {\n const ast: EventModel = await parse('eventmodeling', input);\n log.debug(ast);\n db.setAst(ast);\n populateCommonDb(ast as any, db);\n },\n};\n\nif (import.meta.vitest) {\n const { it, expect, describe } = import.meta.vitest;\n describe('EventModeling Parser', () => {\n it('should parse simple model', () => {\n const result = parser.parse(`eventmodeling\n tf 01 evt Start\n\n `);\n expect(result !== undefined);\n });\n });\n}\n", "import type { BaseType, Selection } from 'd3';\nimport { select } from 'd3';\nimport { getConfig, setupGraphViewbox } from '../../diagram-api/diagramAPI.js';\nimport { log } from '../../logger.js';\nimport type { DrawDefinition } from '../../diagram-api/types.js';\n\nimport type { EventModelingDB, Box, Relation, Swimlane, DiagramProps } from './types.js';\n\nconst DEFAULT_CONFIG = getConfig();\nconst DEFAULT_EVENTMODELING_CONFIG = DEFAULT_CONFIG?.eventmodeling;\n\nfunction renderD3Box(\n diagram: Selection,\n diagramProps: DiagramProps\n) {\n return (box: Box) => {\n const y = box.swimlane.y + diagramProps.swimlanePadding;\n\n const g = diagram.append('g').attr('class', 'em-box');\n\n g.append('rect')\n .attr('x', box.x)\n .attr('y', y)\n .attr('rx', '3')\n .attr('width', box.dimension.width)\n .attr('height', box.dimension.height)\n .attr('stroke', box.visual.stroke)\n .attr('fill', box.visual.fill);\n\n const f = g\n .append('foreignObject')\n .attr('x', box.x + diagramProps.boxPadding)\n .attr('y', y + 10)\n .attr('width', box.dimension.width - 2 * diagramProps.boxPadding)\n .attr('height', box.dimension.height - 2 * diagramProps.boxPadding);\n\n const text = f\n .append('xhtml:div')\n .style('display', 'table')\n .style('height', '100%')\n .style('width', '100%');\n\n text\n .append('span')\n .style('display', 'table-cell')\n .style('text-align', 'center')\n .style('vertical-align', 'middle')\n .html(box.text);\n };\n}\n\nfunction dirUpwards(sourceY: number, targetY: number): boolean {\n return sourceY > targetY;\n}\n\nfunction renderD3Relation(\n diagram: Selection,\n diagramProps: DiagramProps,\n arrowheadId: string,\n themeVariables: Record\n) {\n return (relation: Relation) => {\n const sourceBoxY = relation.sourceBox.swimlane.y + diagramProps.swimlanePadding;\n const targetBoxY = relation.targetBox.swimlane.y + diagramProps.swimlanePadding;\n\n const upwards = dirUpwards(sourceBoxY, targetBoxY);\n\n const sourceX = relation.sourceBox.x + (relation.sourceBox.dimension.width * 2) / 3;\n const targetX = relation.targetBox.x + relation.targetBox.dimension.width / 3;\n\n let sourceY;\n let targetY;\n\n log.debug(`rendering relation up=${upwards} for `, {\n sourceBox: relation.sourceBox,\n targetBox: relation.targetBox,\n });\n if (upwards) {\n sourceY = sourceBoxY;\n targetY = targetBoxY + relation.targetBox.dimension.height;\n } else {\n sourceY = sourceBoxY + relation.sourceBox.dimension.height;\n targetY = targetBoxY;\n }\n\n const relationStroke = themeVariables.emRelationStroke ?? relation.visual.stroke;\n\n diagram\n .append('path')\n .attr('class', 'em-relation')\n .attr('fill', relation.visual.fill)\n .attr('stroke', relationStroke)\n .attr('stroke-width', '1')\n .attr('marker-end', `url(#${arrowheadId})`)\n .attr('d', `M${sourceX} ${sourceY} L${targetX} ${targetY}`);\n };\n}\n\nfunction renderD3Swimlane(\n diagram: Selection,\n maxR: number,\n diagramProps: DiagramProps,\n themeVariables: Record\n) {\n return (swimlane: Swimlane) => {\n const g = diagram.append('g').attr('class', 'em-swimlane');\n\n const oddBackground = themeVariables.emSwimlaneBackgroundOdd ?? 'rgb(250,250,250)';\n const backgroundStroke = themeVariables.emSwimlaneBackgroundStroke ?? 'rgb(240,240,240)';\n\n g.append('rect')\n .attr('x', 0)\n .attr('y', swimlane.y)\n .attr('rx', '3')\n .attr('width', maxR + diagramProps.swimlanePadding)\n .attr('height', swimlane.height)\n .attr('fill', oddBackground)\n .attr('stroke', backgroundStroke);\n\n g.append('text')\n .attr('font-weight', diagramProps.swimlaneTextFontWeight)\n .attr('x', 30)\n .attr('y', swimlane.y + 30)\n .text(swimlane.label);\n };\n}\n\nexport const draw: DrawDefinition = function (txt, id, ver, diagObj) {\n log.debug('in eventmodeling renderer', txt + '\\n', 'id:', id, ver);\n if (!DEFAULT_EVENTMODELING_CONFIG) {\n throw new Error('EventModeling config not found');\n }\n const db = diagObj.db as EventModelingDB;\n const { themeVariables, eventmodeling: config } = getConfig();\n\n const diagram: Selection = select(`[id=\"${id}\"]`);\n\n const diagramProps = db.getDiagramProps();\n const state = db.getState();\n\n const arrowheadId = `em-arrowhead-${id}`;\n const arrowheadColor = themeVariables.emArrowhead ?? '#000000';\n\n state.sortedSwimlanesArray.forEach(\n renderD3Swimlane(diagram, state.maxR, diagramProps, themeVariables)\n );\n state.boxes.forEach(renderD3Box(diagram, diagramProps));\n state.relations.forEach(renderD3Relation(diagram, diagramProps, arrowheadId, themeVariables));\n\n const marker = diagram\n .append('defs')\n .append('marker')\n .attr('id', arrowheadId)\n .attr('markerWidth', '10')\n .attr('markerHeight', '7')\n .attr('refX', '10')\n .attr('refY', '3.5')\n .attr('orient', 'auto');\n\n marker.append('polygon').attr('points', '0 0, 10 3.5, 0 7').attr('fill', arrowheadColor);\n\n setupGraphViewbox(undefined, diagram, config?.padding ?? 30, config?.useMaxWidth);\n};\n\nexport default {\n draw,\n};\n", "const getStyles = (_options) => ``;\n\nexport default getStyles;\n", "import { parser } from './parser.js';\nimport { db } from './db.js';\nimport renderer from './renderer.js';\nimport styles from './styles.js';\nimport type { DiagramDefinition } from '../../diagram-api/types.js';\n\nexport const diagram: DiagramDefinition = {\n parser,\n db,\n renderer: renderer,\n styles: styles,\n};\n"], "mappings": "4rBAoHO,IAAMA,EAAoB,iBAOpBC,EAAsB,mBAStBC,EAAuB,oBAOvBC,EAAyB,sBC1F/B,IAAMC,EAAaC,EAAA,SAAUC,EAAuB,CACzDC,EAAI,MAAM,cAAeD,CAAa,CACxC,EAF0B,cAIbE,GAAaH,EAAA,UAAY,CACpC,MAAO,CAAC,CACV,EAF0B,cAIbI,GAAQJ,EAAA,UAAY,CAC/BK,GAAM,EACND,EAAY,CACd,EAHqB,SAKrB,SAASC,IAAc,CACrBC,EAAQ,CAAC,CACX,CAFSN,EAAAK,GAAA,SAQT,IAAME,GACJC,EAAe,cACXC,GAAYC,EAAA,I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AAM,IAAI,MAAM,gCAAgC,EAElD,IAAMgC,EAAKD,EAAQ,GACb,CAAE,eAAAlB,EAAgB,cAAeoB,CAAO,EAAIlC,EAAU,EAEtDG,EAA0DgC,EAAO,QAAQL,CAAE,IAAI,EAE/E1B,EAAe6B,EAAG,gBAAgB,EAClCG,EAAQH,EAAG,SAAS,EAEpBpB,EAAc,gBAAgBiB,CAAE,GAChCO,EAAiBvB,EAAe,aAAe,UAErDsB,EAAM,qBAAqB,QACzBb,GAAiBpB,EAASiC,EAAM,KAAMhC,EAAcU,CAAc,CACpE,EACAsB,EAAM,MAAM,QAAQlC,GAAYC,EAASC,CAAY,CAAC,EACtDgC,EAAM,UAAU,QAAQxB,GAAiBT,EAASC,EAAcS,EAAaC,CAAc,CAAC,EAE7EX,EACZ,OAAO,MAAM,EACb,OAAO,QAAQ,EACf,KAAK,KAAMU,CAAW,EACtB,KAAK,cAAe,IAAI,EACxB,KAAK,eAAgB,GAAG,EACxB,KAAK,OAAQ,IAAI,EACjB,KAAK,OAAQ,KAAK,EAClB,KAAK,SAAU,MAAM,EAEjB,OAAO,SAAS,EAAE,KAAK,SAAU,kBAAkB,EAAE,KAAK,OAAQwB,CAAc,EAEvFC,EAAkB,OAAWnC,EAAS+B,GAAQ,SAAW,GAAIA,GAAQ,WAAW,CAClF,EAnCoC,QAqC7BK,EAAQ,CACb,KAAAX,EACF,ECtKA,IAAMY,GAAYC,EAACC,GAAa,GAAd,aAEXC,EAAQH,GCIR,IAAMI,GAA6B,CACxC,OAAAC,EACA,GAAAC,EACA,SAAUC,EACV,OAAQC,CACV", "names": ["PositionFrameKind", "FramePositionedKind", "PositionRelationKind", "RelationPositionedKind", "setOptions", "__name", "_rawOptString", "log", "getOptions", "clear", "reset", "store", "DEFAULT_EVENTMODELING_CONFIG", "defaultConfig_default", "getConfig", "__name", "cleanAndMerge", "store", "getState", "state", "initial", "ast", "diagramProps", "getDiagramProps", "frame", "index", "textProps", "calculateTextProps", "dispatch", "PositionFrameKind", "sourceFrames", "hasSourceFrame", "log", "currentFrame", "sf", "sourceFrame", "PositionRelationKind", "sortedSwimlanesArray", "setAst", "extractNamespace", "entityIdentifier", "spl", "extractName", "findSwimlaneByNamespace", "swimlanes", "namespace", "swimlane", "findNextAvailableIndex", "boundaryMin", "boundaryMax", "key", "calculateSwimlaneProps", "sw", "calculateEntityVisualProps", "themeVariables", "dataEntities", "config", "name", "sanitizeText", "toHtml", "wrapLabelConfig", "content", "wrapLabel", "dataEntity", "hasRenderedData", "textDimensionConfig", "dimensions", "calculateTextDimensions", "calculatedWidthFix", "props", "decidePositionFrame", "_command", "command", "visual", "dimension", "FramePositionedKind", "calculateX", "previousSwimlane", "lastBox", "calculateMaxRight", "swimlaneR", "rs", "s", "a", "b", "evolveFramePositioned", "_event", "event", "swimlaneProps", "x", "r", "maxR", "box", "newState", "i", "prevSw", "isFirstFrame", "findBoxByFrame", "boxes", "findBoxByLineIndex", "targetSwimlane", "lineIndex", "decidePositionRelation", "isEmResetFrame", "targetBox", "sourceBox", "RelationPositionedKind", "evolveRelationPositioned", "relation", "deciders", "evolvers", "decide", "fn", "events", "evolve", "previousState", "db", "setOptions", "getOptions", "clear", "setAccTitle", "getAccTitle", "getAccDescription", "setAccDescription", "setDiagramTitle", "getDiagramTitle", "parser", "__name", "input", "ast", "parse", "log", "db", "populateCommonDb", "DEFAULT_CONFIG", "getConfig", "DEFAULT_EVENTMODELING_CONFIG", "renderD3Box", "diagram", "diagramProps", "box", "y", "g", "__name", "dirUpwards", "sourceY", "targetY", "renderD3Relation", "arrowheadId", "themeVariables", "relation", "sourceBoxY", "targetBoxY", "upwards", "sourceX", "targetX", "log", "relationStroke", "renderD3Swimlane", "maxR", "swimlane", "oddBackground", "backgroundStroke", "draw", "txt", "id", "ver", "diagObj", "db", "config", "select_default", "state", "arrowheadColor", "setupGraphViewbox", "renderer_default", "getStyles", "__name", "_options", "styles_default", "diagram", "parser", "db", "renderer_default", "styles_default"] }