agentic-mermaid 0.2.0 → 0.3.1
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/CHANGELOG.md +31 -0
- package/dist/agent-core.d.ts +8 -3
- package/dist/agent-core.js +2 -2
- package/dist/agent.d.ts +2 -2
- package/dist/agent.js +4 -4
- package/dist/agentic-mermaid-mcp.js +5 -5
- package/dist/am.js +6 -6
- package/dist/browser-lazy/chunks/architecture-3CGEU363.js +31 -0
- package/dist/browser-lazy/chunks/chunk-2U4EUPSI.js +4 -0
- package/dist/browser-lazy/chunks/chunk-4IUBLBJJ.js +11 -0
- package/dist/browser-lazy/chunks/chunk-4U2TVB2S.js +1 -0
- package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +1 -0
- package/dist/browser-lazy/chunks/chunk-6UT2VTFI.js +1 -0
- package/dist/browser-lazy/chunks/chunk-7D24ZLOV.js +1 -0
- package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +143 -0
- package/dist/browser-lazy/chunks/chunk-CTVVJPMX.js +24 -0
- package/dist/browser-lazy/chunks/chunk-DPSSG7LR.js +4 -0
- package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +1 -0
- package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +2 -0
- package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +2 -0
- package/dist/browser-lazy/chunks/chunk-FXBBGAMJ.js +46 -0
- package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
- package/dist/browser-lazy/chunks/chunk-HZ4ADQMK.js +1 -0
- package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +1 -0
- package/dist/browser-lazy/chunks/chunk-JX5ZZY3T.js +1 -0
- package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +1 -0
- package/dist/browser-lazy/chunks/chunk-KTTWXSIX.js +1 -0
- package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +1 -0
- package/dist/browser-lazy/chunks/chunk-MMWVZP6M.js +1 -0
- package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +1 -0
- package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +1 -0
- package/dist/browser-lazy/chunks/chunk-PXRUFH7U.js +1 -0
- package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +1 -0
- package/dist/browser-lazy/chunks/chunk-RVO6J7S3.js +1 -0
- package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +1 -0
- package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +3 -0
- package/dist/browser-lazy/chunks/chunk-VDTSULBU.js +7 -0
- package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +1 -0
- package/dist/browser-lazy/chunks/class-B3AVLSIF.js +9 -0
- package/dist/browser-lazy/chunks/er-AF4BKKKC.js +9 -0
- package/dist/browser-lazy/chunks/flowchart-BE6BQZLZ.js +4 -0
- package/dist/browser-lazy/chunks/gantt-U4BMMSEL.js +28 -0
- package/dist/browser-lazy/chunks/gitgraph-UPSWNFRP.js +8 -0
- package/dist/browser-lazy/chunks/journey-PDZ7FDJR.js +40 -0
- package/dist/browser-lazy/chunks/mindmap-BFEUURLS.js +9 -0
- package/dist/browser-lazy/chunks/pie-ZFYW5JZO.js +19 -0
- package/dist/browser-lazy/chunks/quadrant-XJVEYYXK.js +24 -0
- package/dist/browser-lazy/chunks/radar-OVXFNRNC.js +32 -0
- package/dist/browser-lazy/chunks/render-core-R4ZGGEFS.js +12 -0
- package/dist/browser-lazy/chunks/sequence-AWY6JCSB.js +12 -0
- package/dist/browser-lazy/chunks/state-TCE4DXKR.js +4 -0
- package/dist/browser-lazy/chunks/timeline-W4ZVT3FF.js +20 -0
- package/dist/browser-lazy/chunks/xychart-K3QQACKS.js +36 -0
- package/dist/browser-lazy/index.d.ts +1012 -0
- package/dist/browser-lazy/index.js +1 -0
- package/dist/browser.global.js +778 -0
- package/dist/{chunk-MYPDVZCO.js → chunk-BSVM3VMO.js} +18 -5
- package/dist/{chunk-2P5FKUQC.js → chunk-FGO3J7RA.js} +7 -7
- package/dist/{chunk-2SILJDW2.js → chunk-JJ7JRYZV.js} +2 -2
- package/dist/{chunk-2S3VSS6I.js → chunk-KQMJ37OY.js} +4 -4
- package/dist/{chunk-FDM43XU7.js → chunk-MBIR6S3B.js} +2 -2
- package/dist/{chunk-BJYMBT4I.js → chunk-XVY324NY.js} +47701 -47630
- package/dist/{index-DWPa2MJs.d.ts → index-Do8z5rPq.d.ts} +5409 -5391
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp-cli-7FLGTEG3.js +17 -0
- package/docs/README.md +1 -0
- package/docs/browser.md +491 -0
- package/docs/fork-differences.md +33 -0
- package/docs/style-authoring.md +1 -1
- package/package.json +19 -5
- package/server.json +2 -2
- package/dist/mcp-cli-5J47WEY3.js +0 -17
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { g0 as ARCHITECTURE_ICON_LIMITS, g as AnyPort, r as ArchitectureVisualOverrides, s as AsciiRenderColorMode, A as AsciiRenderOptions, t as AsciiWidthError, u as AsciiWidthErrorReason, B as BACKEND_CONFORMANCE_CHECK_IDS, v as BACKEND_CONFORMANCE_FIXTURE_ID, w as BACKEND_CONFORMANCE_VERSION, x as BINDABLE_ROLE_STYLE_PROPERTIES, y as BINDABLE_SCENE_ROLES, z as BRAND_CONSTRAINT_DESCRIPTORS, C as BRAND_CONSTRAINT_KINDS, g1 as BROWSER_CANVAS_RUNTIME, G as BUILTIN_SCENE_ROLE_TRAITS, I as BackendCapabilityConformanceResult, J as BackendCapabilityConformanceStatus, K as BackendConformanceCheck, L as BackendConformanceCheckId, M as BackendConformanceReport, N as BackendDescriptor, O as BackendRegistrationOptions, Q as BindableSceneRole, S as BrandConstraint, T as BrandConstraintAction, U as BrandConstraintKind, g2 as BrowserPngDiagnostic, g3 as BrowserPngFontSource, g4 as BrowserPngRasterContext, g5 as BrowserPngRasterResult, g6 as BrowserPngRasterizer, g7 as BrowserPngRuntimeProvenance, g8 as BuiltinSceneRole, X as CAPABILITY_NEGOTIATION_VERSION, Y as CORE_CAPABILITY_OFFERS, Z as CORE_SCENE_FEATURES, _ as CORE_SCENE_OPERATIONS, $ as CORE_SCENE_PRIMITIVES, a0 as CapabilityDecision, a1 as CapabilityId, a2 as CapabilityOffer, a3 as CapabilityRequirement, a4 as CapabilityRequirementLevel, a5 as CapabilityResolution, g9 as CapabilityValidationResult, ad as CliRenderTransport, ae as CodeModeRenderTransport, ga as ConfigDiagnostic, af as ConnectorContourSemantics, gb as ConnectorDash, gc as ConnectorDirection, gd as ConnectorEndpointAnchor, ag as ConnectorEndpoints, ah as ConnectorGeometry, ai as ConnectorHitGeometry, aj as ConnectorLabelDescriptor, ak as ConnectorMark, al as ConnectorRelationship, am as ConnectorRoute, an as ConnectorStroke, ao as ConnectorSubpath, ap as ConnectorTerminalLabelProjection, aq as ConnectorTerminalMarkerPlacement, ar as ConnectorTerminalMarkerProjection, as as ConnectorTerminalProjection, at as ConnectorTerminalStrokeLoss, ge as CoreSceneFeature, gf as CoreSceneOperation, gg as CoreScenePrimitive, gh as CoreSceneRole, gi as DEFAULTS, av as DefaultBackend, gj as DiagramColors, aB as DiamondFacet, gk as DocumentMark, gl as ESSENTIAL_SCENE_PRIMITIVE_CAPABILITIES, gm as ESSENTIAL_SCENE_PRIMITIVE_OPERATIONS, aC as EXACT_ROLE_STYLE_CONTRACT, aD as EXACT_STYLE_SCENE_ROLES, aE as EXTERNAL_SCENE_API_VERSION, aG as EdgeRouteCertificate, gn as EssentialScenePrimitiveCapability, go as EssentialScenePrimitiveOperation, aO as ExactStyleSceneRole, gp as ExtensionCollisionError, gq as ExtensionCompatibility, gr as ExtensionCompatibilityDecision, gs as ExtensionCompatibilityResolution, aP as ExtensionDiagramBody, aQ as ExtensionIdentity, gt as ExtensionProvenance, gu as ExtensionRegistration, aR as ExtensionValidDiagram, aT as ExternalSceneConnector, aU as ExternalSceneConnectorGeometry, aV as ExternalSceneConnectorLabel, aW as ExternalSceneContainer, aX as ExternalSceneDataMark, aY as ExternalSceneDocument, aZ as ExternalSceneGeometry, a_ as ExternalSceneInput, a$ as ExternalSceneMarker, b0 as ExternalSceneNode, b1 as ExternalSceneNodeBase, b2 as ExternalSceneShape, b3 as ExternalSceneText, bg as FamilyDetectionDiagnostic, bh as FamilyEdgeRouteCertificate, bo as FamilyRouteCertificate, gv as Geometry, gw as GitGraphBranch, gx as GitGraphCommit, gy as GitGraphCommitType, gz as GitGraphDiagram, gA as GitGraphDuplicateCommitError, gB as GitGraphParseError, gC as GitGraphRuntimeConfig, gD as GroupMark, bJ as HOSTED_FONT_RESOURCES, H as HostBackendPolicy, gE as HostBackendSelection, gF as HostedFontFace, gG as HostedFontResource, gH as JourneyRuntimeConfig, gI as KNOWN_EXTENSION_CONTRACT_VERSIONS, bQ as LayoutRouteCertificate, bR as LayoutRouteClass, bT as LibraryRenderTransport, bU as MAX_HOSTED_PNG_BYTES, bV as MAX_HOSTED_PNG_PIXELS, bW as MAX_PNG_FONT_DIRECTORIES, bX as MAX_PNG_FONT_DIRECTORY_LENGTH, bY as MAX_PNG_PIXELS, bZ as MAX_PNG_RASTER_DIMENSION, gJ as MarkPaint, b_ as MarkerDescriptor, gK as MarkerSerializationOptions, gL as MarkerShape, gM as MermaidBrowserPNGRenderer, gN as MermaidBrowserPNGRendererHostOptions, b$ as MermaidFamilyClassification, c0 as MermaidFamilyDetectionError, gO as MermaidGraph, gP as MermaidRenderer, gQ as MermaidRendererHostOptions, gR as MermaidRuntimeConfig, gS as MermaidThemeVariables, gT as MindmapDiagram, gU as MindmapDuplicateIdError, gV as MindmapNode, gW as MindmapParseError, gX as MindmapRuntimeConfig, gY as MindmapShape, c6 as NATIVE_PNG_HOST_ONLY_OPTION_FIELDS, c7 as NATIVE_PNG_OUTPUT_POLICY_FIELDS, gZ as NamespacedSceneRole, c8 as NativePngHostOnlyOptionField, c9 as NativePngOutputPolicyField, g_ as OUTPUT_COLOR_PROFILE, g$ as OUTPUT_SECURITY_POLICY_VERSION, h0 as OutputSecurityDiagnostic, h1 as OutputSecurityMode, h2 as OutputSecurityResult, cb as PNG_DEFAULT_FONT_FAMILY, cc as PNG_DEFAULT_SCALE, cd as PNG_FONT_SOURCES, ce as PNG_NAPI_RUNTIME, cf as PNG_OUTPUT_OPTION_FIELDS, cg as PNG_OUTPUT_OPTION_FIELD_DESCRIPTORS, ch as PNG_OUTPUT_POLICY_VERSION, ci as PNG_WASM_RUNTIME, cj as PORTABLE_PNG_OUTPUT_OPTION_FIELDS, ck as PRIMITIVE_REALIZATIONS, P as ParsedDiagram, h3 as ParsedDiagramFamilyMismatchError, h4 as PieRuntimeConfig, h5 as PngColorProfileReceipt, h6 as PngDimensions, cr as PngFitTo, cs as PngFontSource, ct as PngOutputOptionField, cu as PngOutputOptionFieldDescriptor, cv as PngOutputOptionInputKind, cw as PngOutputOptionPolicyState, cx as PngOutputOptionReceiptState, cy as PngOutputOptionScope, a as PngOutputPolicyInput, cz as PngRasterDimensions, c as PngRuntimeProvenance, cA as PortSemanticRole, cB as PortSide, cC as PortablePngOutputOptionField, cD as PortablePngOutputOptions, fX as PositionedDiagram, h7 as PositionedGitGraphDiagram, h8 as PositionedGraph, h9 as PositionedMindmapDiagram, cE as PreservedDiagramBody, cF as PreservedSourceSpans, cG as PreservedValidDiagram, ha as PrimitiveCapabilityClaim, hb as PrimitiveRealization, hc as QuadrantRuntimeConfig, cM as RENDER_CONTRACT_VERSION, cN as RENDER_OUTPUTS, cO as RENDER_OUTPUT_DESCRIPTORS, cP as RESOURCE_MANIFEST, cQ as RESOURCE_MANIFEST_VERSION, cR as ROLE_STYLE_PROPERTY_DESCRIPTORS, hd as RadarRuntimeConfig, cX as RegionContainmentCertificate, cY as RenderCapabilityError, he as RenderContext, R as RenderOptions, hf as RenderOutput, cZ as RenderOutputDescriptor, c_ as RenderOutputTransports, b as RenderRequestReceipt, hg as RenderableMarkerDescriptor, c$ as RenderedAscii, hh as RenderedBrowserPng, f$ as RenderedSvg, hi as ResolvedArchitectureIcon, hj as ResolvedColors, d5 as ResolvedPngOutputPolicy, hk as ResolvedSceneRoleTraits, d6 as ResolvedTerminalOutputPolicy, hl as ResolvedTerminalStyle, hm as ResourceLicense, hn as ResourceManifest, ho as ResourceManifestEntry, d8 as RoleStyleFor, d9 as RoleStyleSpec, da as RoleStyles, db as RouteBlocker, dc as RouteCertificate, dd as RouteClass, de as RoutePortAssignment, df as SCENE_CONTRACT_VERSION, dg as SCENE_ROLE_DESCRIPTORS, dh as SCENE_VALIDATION_LIMITS, di as SCENE_VALIDATION_VERSION, dj as SEMANTIC_BINDING_CHANNELS, dk as SHARED_RENDER_OPTION_FIELDS, dl as STYLE_COLOR_TOKEN_DESCRIPTORS, dm as STYLE_SPEC_FIELD_DESCRIPTORS, dn as STYLE_SPEC_FORMAT_VERSION, hp as SceneBox, hq as SceneConnectorHit, dp as SceneDoc, hr as SceneFeature, hs as SceneMarkKind, dq as SceneNode, ht as SceneNodeBase, hu as SceneOperation, hv as ScenePoint, hw as ScenePrimitive, dr as SceneRole, hx as SceneRoleDescriptor, hy as SceneRoleTraits, hz as SceneSketchPolicy, ds as SceneValidationDiagnostic, dt as SceneValidationDiagnosticCode, du as SceneValidationError, dv as SceneValidationOptions, dw as SceneValidationResult, dx as SemanticBinding, dy as SemanticBindingChannel, dz as SemanticChannels, dA as SemanticSlots, hA as ShapeMark, dM as SourceSpan, dN as SourceSpanPoint, hB as StateRuntimeConfig, dT as StyleBackend, dU as StyleBackendContext, dV as StyleColors, dW as StyleDescriptor, dX as StyleInput, dY as StyleReferenceResolution, dZ as StyleRegistrationOptions, hC as StyleRegistryKind, d_ as StyleSpec, hD as SvgRelationSemantics, hE as SvgSemanticAccessibility, hF as SvgSemanticIdentity, d$ as TERMINAL_BOUNDED_PADDING_X, e0 as TERMINAL_DEFAULT_BOX_BORDER_PADDING, e1 as TERMINAL_DEFAULT_PADDING_X, e2 as TERMINAL_DEFAULT_PADDING_Y, e3 as TERMINAL_OUTPUT_POLICY_VERSION, hG as TERMINAL_STYLE_VERSION, e4 as TEXT_MEASUREMENT_CONTRACT, hH as TerminalConnectorProjection, hI as TerminalConnectorProjectionReceipt, e5 as TerminalOutputPolicyError, e6 as TerminalOutputPolicyInput, hJ as TerminalProjectionDiagnostic, fY as TerminalProjectionDiagnosticCode, hK as TerminalProjectionSecurityContext, hL as TextMark, e7 as TextMeasurementContract, e8 as TextMeasurementInput, e9 as TextMeasurementResult, hM as TimelineRuntimeConfig, hN as XyChartRuntimeConfig, hO as applyOutputSecurityPolicy, hP as applyPngColorProfile, hQ as architectureIconManifest, hR as architectureToMermaidGraph, eV as assertHostedPngRasterBudget, eW as assertPngRasterBudget, hS as assertRenderableMarker, eX as assertValidSceneDoc, eY as buildExternalScene, hT as canonicalExtensionId, e_ as classifyMermaidFamilyFromFirstLine, hU as connectorHitDistance, e$ as createExtensionIdentity, hV as createMermaidBrowserPNGRenderer, hW as createMermaidRenderer, hX as essentialScenePrimitiveOperation, hY as evaluateExtensionCompatibility, hZ as fromShikiTheme, f5 as getBackend, f8 as getStyle, h_ as hitTestConnector, h$ as hitTestSceneConnectors, f9 as hostedFontResource, fa as inferBackend, i0 as inlineResolvedColors, i1 as inspectPngColorProfile, i2 as inspectPngDimensions, fd as knownBackendDescriptors, fg as knownStyleDescriptors, fh as knownStyles, fi as measureText, fj as measureTextWidth, fk as negotiateCapabilities, fl as negotiateRenderCapabilities, fm as normalizePortablePngBackground, fo as omitPngOutputOptions, i3 as parseArchitectureDiagram, i4 as parseExtensionId, i5 as parseGitGraph, i6 as parseMindmap, fp as parseRegisteredMermaid, fq as parseSemVer, fr as pngNapiRuntimeProvenance, fs as pngOutputOptionsJsonSchema, ft as pngRasterDimensions, fu as prepareSvgForPngRasterization, fv as projectNativePngOutputPolicyInput, fw as projectPortablePngOutputOptions, fx as registerBackend, i7 as registerExtension, fy as registerStyle, i8 as renderContractDigest, fZ as renderMermaidASCII, i9 as renderMermaidASCIIWithReceipt, ia as renderMermaidPNGInBrowserWithReceipt, f_ as renderMermaidSVG, ib as renderMermaidSVGAsync, ic as renderMermaidSVGWithReceipt, id as resolveArchitectureIcon, ie as resolveColors, ig as resolveDiagramColors, fz as resolvePngOutputPolicy, fA as resolvePortablePngOutputPolicy, fB as resolveSceneRoleTraits, fC as resolveStyleReference, fD as resolveStyleStack, fE as resolveTerminalOutputPolicy, fF as runBackendConformance, fG as sceneRoleTraits, fH as semVerSatisfies, ih as serializeGitGraph, ii as serializeMarkerResource, ij as serializeMarkerResources, ik as serializeMindmap, fI as sharedRenderOptionsJsonSchema, il as snapshotResourceManifest, fJ as styleInputJsonSchema, fK as styleSpecJsonSchema, fL as svgIntrinsicDimensions, fM as terminalConnectorCapabilityClaims, fO as validatePrimitiveCapabilities, fP as validateResourceManifest, fQ as validateSceneDoc, fR as validateSerializableRenderOptions, fS as validateStyleSpec, fT as verifyNoExternalRefs, fU as verifyResourceBytes, im as verifySvgDocumentEnvelope } from './index-DWPa2MJs.js';
|
|
1
|
+
export { g0 as ARCHITECTURE_ICON_LIMITS, g as AnyPort, r as ArchitectureVisualOverrides, s as AsciiRenderColorMode, A as AsciiRenderOptions, t as AsciiWidthError, u as AsciiWidthErrorReason, B as BACKEND_CONFORMANCE_CHECK_IDS, v as BACKEND_CONFORMANCE_FIXTURE_ID, w as BACKEND_CONFORMANCE_VERSION, x as BINDABLE_ROLE_STYLE_PROPERTIES, y as BINDABLE_SCENE_ROLES, z as BRAND_CONSTRAINT_DESCRIPTORS, C as BRAND_CONSTRAINT_KINDS, g1 as BROWSER_CANVAS_RUNTIME, G as BUILTIN_SCENE_ROLE_TRAITS, I as BackendCapabilityConformanceResult, J as BackendCapabilityConformanceStatus, K as BackendConformanceCheck, L as BackendConformanceCheckId, M as BackendConformanceReport, N as BackendDescriptor, O as BackendRegistrationOptions, Q as BindableSceneRole, S as BrandConstraint, T as BrandConstraintAction, U as BrandConstraintKind, g2 as BrowserPngDiagnostic, g3 as BrowserPngFontSource, g4 as BrowserPngRasterContext, g5 as BrowserPngRasterResult, g6 as BrowserPngRasterizer, g7 as BrowserPngRuntimeProvenance, g8 as BuiltinSceneRole, X as CAPABILITY_NEGOTIATION_VERSION, Y as CORE_CAPABILITY_OFFERS, Z as CORE_SCENE_FEATURES, _ as CORE_SCENE_OPERATIONS, $ as CORE_SCENE_PRIMITIVES, a0 as CapabilityDecision, a1 as CapabilityId, a2 as CapabilityOffer, a3 as CapabilityRequirement, a4 as CapabilityRequirementLevel, a5 as CapabilityResolution, g9 as CapabilityValidationResult, ad as CliRenderTransport, ae as CodeModeRenderTransport, ga as ConfigDiagnostic, af as ConnectorContourSemantics, gb as ConnectorDash, gc as ConnectorDirection, gd as ConnectorEndpointAnchor, ag as ConnectorEndpoints, ah as ConnectorGeometry, ai as ConnectorHitGeometry, aj as ConnectorLabelDescriptor, ak as ConnectorMark, al as ConnectorRelationship, am as ConnectorRoute, an as ConnectorStroke, ao as ConnectorSubpath, ap as ConnectorTerminalLabelProjection, aq as ConnectorTerminalMarkerPlacement, ar as ConnectorTerminalMarkerProjection, as as ConnectorTerminalProjection, at as ConnectorTerminalStrokeLoss, ge as CoreSceneFeature, gf as CoreSceneOperation, gg as CoreScenePrimitive, gh as CoreSceneRole, gi as DEFAULTS, av as DefaultBackend, gj as DiagramColors, aB as DiamondFacet, gk as DocumentMark, gl as ESSENTIAL_SCENE_PRIMITIVE_CAPABILITIES, gm as ESSENTIAL_SCENE_PRIMITIVE_OPERATIONS, aC as EXACT_ROLE_STYLE_CONTRACT, aD as EXACT_STYLE_SCENE_ROLES, aE as EXTERNAL_SCENE_API_VERSION, aG as EdgeRouteCertificate, gn as EssentialScenePrimitiveCapability, go as EssentialScenePrimitiveOperation, aO as ExactStyleSceneRole, gp as ExtensionCollisionError, gq as ExtensionCompatibility, gr as ExtensionCompatibilityDecision, gs as ExtensionCompatibilityResolution, aP as ExtensionDiagramBody, aQ as ExtensionIdentity, gt as ExtensionProvenance, gu as ExtensionRegistration, aR as ExtensionValidDiagram, aT as ExternalSceneConnector, aU as ExternalSceneConnectorGeometry, aV as ExternalSceneConnectorLabel, aW as ExternalSceneContainer, aX as ExternalSceneDataMark, aY as ExternalSceneDocument, aZ as ExternalSceneGeometry, a_ as ExternalSceneInput, a$ as ExternalSceneMarker, b0 as ExternalSceneNode, b1 as ExternalSceneNodeBase, b2 as ExternalSceneShape, b3 as ExternalSceneText, bg as FamilyDetectionDiagnostic, bh as FamilyEdgeRouteCertificate, bo as FamilyRouteCertificate, gv as Geometry, gw as GitGraphBranch, gx as GitGraphCommit, gy as GitGraphCommitType, gz as GitGraphDiagram, gA as GitGraphDuplicateCommitError, gB as GitGraphParseError, gC as GitGraphRuntimeConfig, gD as GroupMark, bJ as HOSTED_FONT_RESOURCES, H as HostBackendPolicy, gE as HostBackendSelection, gF as HostedFontFace, gG as HostedFontResource, gH as JourneyRuntimeConfig, gI as KNOWN_EXTENSION_CONTRACT_VERSIONS, bQ as LayoutRouteCertificate, bR as LayoutRouteClass, bT as LibraryRenderTransport, bU as MAX_HOSTED_PNG_BYTES, bV as MAX_HOSTED_PNG_PIXELS, bW as MAX_PNG_FONT_DIRECTORIES, bX as MAX_PNG_FONT_DIRECTORY_LENGTH, bY as MAX_PNG_PIXELS, bZ as MAX_PNG_RASTER_DIMENSION, gJ as MarkPaint, b_ as MarkerDescriptor, gK as MarkerSerializationOptions, gL as MarkerShape, gM as MermaidBrowserPNGRenderer, gN as MermaidBrowserPNGRendererHostOptions, b$ as MermaidFamilyClassification, c0 as MermaidFamilyDetectionError, gO as MermaidGraph, gP as MermaidRenderer, gQ as MermaidRendererHostOptions, gR as MermaidRuntimeConfig, gS as MermaidThemeVariables, gT as MindmapDiagram, gU as MindmapDuplicateIdError, gV as MindmapNode, gW as MindmapParseError, gX as MindmapRuntimeConfig, gY as MindmapShape, c6 as NATIVE_PNG_HOST_ONLY_OPTION_FIELDS, c7 as NATIVE_PNG_OUTPUT_POLICY_FIELDS, gZ as NamespacedSceneRole, c8 as NativePngHostOnlyOptionField, c9 as NativePngOutputPolicyField, g_ as OUTPUT_COLOR_PROFILE, g$ as OUTPUT_SECURITY_POLICY_VERSION, h0 as OutputSecurityDiagnostic, h1 as OutputSecurityMode, h2 as OutputSecurityResult, cb as PNG_DEFAULT_FONT_FAMILY, cc as PNG_DEFAULT_SCALE, cd as PNG_FONT_SOURCES, ce as PNG_NAPI_RUNTIME, cf as PNG_OUTPUT_OPTION_FIELDS, cg as PNG_OUTPUT_OPTION_FIELD_DESCRIPTORS, ch as PNG_OUTPUT_POLICY_VERSION, ci as PNG_WASM_RUNTIME, cj as PORTABLE_PNG_OUTPUT_OPTION_FIELDS, ck as PRIMITIVE_REALIZATIONS, P as ParsedDiagram, h3 as ParsedDiagramFamilyMismatchError, h4 as PieRuntimeConfig, h5 as PngColorProfileReceipt, h6 as PngDimensions, cr as PngFitTo, cs as PngFontSource, ct as PngOutputOptionField, cu as PngOutputOptionFieldDescriptor, cv as PngOutputOptionInputKind, cw as PngOutputOptionPolicyState, cx as PngOutputOptionReceiptState, cy as PngOutputOptionScope, a as PngOutputPolicyInput, cz as PngRasterDimensions, c as PngRuntimeProvenance, cA as PortSemanticRole, cB as PortSide, cC as PortablePngOutputOptionField, cD as PortablePngOutputOptions, fX as PositionedDiagram, h7 as PositionedGitGraphDiagram, h8 as PositionedGraph, h9 as PositionedMindmapDiagram, cE as PreservedDiagramBody, cF as PreservedSourceSpans, cG as PreservedValidDiagram, ha as PrimitiveCapabilityClaim, hb as PrimitiveRealization, hc as QuadrantRuntimeConfig, cM as RENDER_CONTRACT_VERSION, cN as RENDER_OUTPUTS, cO as RENDER_OUTPUT_DESCRIPTORS, cP as RESOURCE_MANIFEST, cQ as RESOURCE_MANIFEST_VERSION, cR as ROLE_STYLE_PROPERTY_DESCRIPTORS, hd as RadarRuntimeConfig, cX as RegionContainmentCertificate, cY as RenderCapabilityError, he as RenderContext, R as RenderOptions, hf as RenderOutput, cZ as RenderOutputDescriptor, c_ as RenderOutputTransports, b as RenderRequestReceipt, hg as RenderableMarkerDescriptor, c$ as RenderedAscii, hh as RenderedBrowserPng, f$ as RenderedSvg, hi as ResolvedArchitectureIcon, hj as ResolvedColors, d5 as ResolvedPngOutputPolicy, hk as ResolvedSceneRoleTraits, d6 as ResolvedTerminalOutputPolicy, hl as ResolvedTerminalStyle, hm as ResourceLicense, hn as ResourceManifest, ho as ResourceManifestEntry, d8 as RoleStyleFor, d9 as RoleStyleSpec, da as RoleStyles, db as RouteBlocker, dc as RouteCertificate, dd as RouteClass, de as RoutePortAssignment, df as SCENE_CONTRACT_VERSION, dg as SCENE_ROLE_DESCRIPTORS, dh as SCENE_VALIDATION_LIMITS, di as SCENE_VALIDATION_VERSION, dj as SEMANTIC_BINDING_CHANNELS, dk as SHARED_RENDER_OPTION_FIELDS, dl as STYLE_COLOR_TOKEN_DESCRIPTORS, dm as STYLE_SPEC_FIELD_DESCRIPTORS, dn as STYLE_SPEC_FORMAT_VERSION, hp as SceneBox, hq as SceneConnectorHit, dp as SceneDoc, hr as SceneFeature, hs as SceneMarkKind, dq as SceneNode, ht as SceneNodeBase, hu as SceneOperation, hv as ScenePoint, hw as ScenePrimitive, dr as SceneRole, hx as SceneRoleDescriptor, hy as SceneRoleTraits, hz as SceneSketchPolicy, ds as SceneValidationDiagnostic, dt as SceneValidationDiagnosticCode, du as SceneValidationError, dv as SceneValidationOptions, dw as SceneValidationResult, dx as SemanticBinding, dy as SemanticBindingChannel, dz as SemanticChannels, dA as SemanticSlots, hA as ShapeMark, dM as SourceSpan, dN as SourceSpanPoint, hB as StateRuntimeConfig, dT as StyleBackend, dU as StyleBackendContext, dV as StyleColors, dW as StyleDescriptor, dX as StyleInput, dY as StyleReferenceResolution, dZ as StyleRegistrationOptions, hC as StyleRegistryKind, d_ as StyleSpec, hD as SvgRelationSemantics, hE as SvgSemanticAccessibility, hF as SvgSemanticIdentity, d$ as TERMINAL_BOUNDED_PADDING_X, e0 as TERMINAL_DEFAULT_BOX_BORDER_PADDING, e1 as TERMINAL_DEFAULT_PADDING_X, e2 as TERMINAL_DEFAULT_PADDING_Y, e3 as TERMINAL_OUTPUT_POLICY_VERSION, hG as TERMINAL_STYLE_VERSION, e4 as TEXT_MEASUREMENT_CONTRACT, hH as TerminalConnectorProjection, hI as TerminalConnectorProjectionReceipt, e5 as TerminalOutputPolicyError, e6 as TerminalOutputPolicyInput, hJ as TerminalProjectionDiagnostic, fY as TerminalProjectionDiagnosticCode, hK as TerminalProjectionSecurityContext, hL as TextMark, e7 as TextMeasurementContract, e8 as TextMeasurementInput, e9 as TextMeasurementResult, hM as TimelineRuntimeConfig, hN as XyChartRuntimeConfig, hO as applyOutputSecurityPolicy, hP as applyPngColorProfile, hQ as architectureIconManifest, hR as architectureToMermaidGraph, eV as assertHostedPngRasterBudget, eW as assertPngRasterBudget, hS as assertRenderableMarker, eX as assertValidSceneDoc, eY as buildExternalScene, hT as canonicalExtensionId, e_ as classifyMermaidFamilyFromFirstLine, hU as connectorHitDistance, e$ as createExtensionIdentity, hV as createMermaidBrowserPNGRenderer, hW as createMermaidRenderer, hX as essentialScenePrimitiveOperation, hY as evaluateExtensionCompatibility, hZ as fromShikiTheme, f5 as getBackend, f8 as getStyle, h_ as hitTestConnector, h$ as hitTestSceneConnectors, f9 as hostedFontResource, fa as inferBackend, i0 as inlineResolvedColors, i1 as inspectPngColorProfile, i2 as inspectPngDimensions, fd as knownBackendDescriptors, fg as knownStyleDescriptors, fh as knownStyles, fi as measureText, fj as measureTextWidth, fk as negotiateCapabilities, fl as negotiateRenderCapabilities, fm as normalizePortablePngBackground, fo as omitPngOutputOptions, i3 as parseArchitectureDiagram, i4 as parseExtensionId, i5 as parseGitGraph, i6 as parseMindmap, fp as parseRegisteredMermaid, fq as parseSemVer, fr as pngNapiRuntimeProvenance, fs as pngOutputOptionsJsonSchema, ft as pngRasterDimensions, fu as prepareSvgForPngRasterization, fv as projectNativePngOutputPolicyInput, fw as projectPortablePngOutputOptions, fx as registerBackend, i7 as registerExtension, fy as registerStyle, i8 as renderContractDigest, fZ as renderMermaidASCII, i9 as renderMermaidASCIIWithReceipt, ia as renderMermaidPNGInBrowserWithReceipt, f_ as renderMermaidSVG, ib as renderMermaidSVGAsync, ic as renderMermaidSVGWithReceipt, id as resolveArchitectureIcon, ie as resolveColors, ig as resolveDiagramColors, fz as resolvePngOutputPolicy, fA as resolvePortablePngOutputPolicy, fB as resolveSceneRoleTraits, fC as resolveStyleReference, fD as resolveStyleStack, fE as resolveTerminalOutputPolicy, fF as runBackendConformance, fG as sceneRoleTraits, fH as semVerSatisfies, ih as serializeGitGraph, ii as serializeMarkerResource, ij as serializeMarkerResources, ik as serializeMindmap, fI as sharedRenderOptionsJsonSchema, il as snapshotResourceManifest, fJ as styleInputJsonSchema, fK as styleSpecJsonSchema, fL as svgIntrinsicDimensions, fM as terminalConnectorCapabilityClaims, fO as validatePrimitiveCapabilities, fP as validateResourceManifest, fQ as validateSceneDoc, fR as validateSerializableRenderOptions, fS as validateStyleSpec, fT as verifyNoExternalRefs, fU as verifyResourceBytes, im as verifySvgDocumentEnvelope } from './index-Do8z5rPq.js';
|
package/dist/index.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
MCP_CLI_HELP,
|
|
3
|
+
MCP_FLAG_SPECS,
|
|
4
|
+
parseMcpCliOptions,
|
|
5
|
+
runMcpCli
|
|
6
|
+
} from "./chunk-FGO3J7RA.js";
|
|
7
|
+
import "./chunk-JJ7JRYZV.js";
|
|
8
|
+
import "./chunk-MBIR6S3B.js";
|
|
9
|
+
import "./chunk-BSVM3VMO.js";
|
|
10
|
+
import "./chunk-XVY324NY.js";
|
|
11
|
+
export {
|
|
12
|
+
MCP_CLI_HELP,
|
|
13
|
+
MCP_FLAG_SPECS,
|
|
14
|
+
parseMcpCliOptions,
|
|
15
|
+
runMcpCli
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=mcp-cli-7FLGTEG3.js.map
|
package/docs/README.md
CHANGED
|
@@ -15,6 +15,7 @@ This directory holds the long-form documentation. The root README is intentional
|
|
|
15
15
|
| [`design/families/style-switch-contact-sheet.html`](https://github.com/adewale/agentic-mermaid/blob/main/docs/design/families/style-switch-contact-sheet.html) | Self-contained interactive contact sheet for every registered family and every built-in Look/Palette Style resource. |
|
|
16
16
|
| [`custom-fonts.md`](./custom-fonts.md) | How custom Styles select and resolve fonts across SVG, PNG, browser, and MCP surfaces. |
|
|
17
17
|
| [`react.md`](./react.md) | Zero-flash React rendering with CSS variables. |
|
|
18
|
+
| [`browser.md`](./browser.md) | Framework-neutral pre-rendering, Alpine and plain-JS adapters, the classic `<script src>` bundle, and the shipped lazy all-family browser renderer. |
|
|
18
19
|
| [`ascii.md`](./ascii.md) | Terminal output, ASCII vs Unicode, color modes, XY charts. |
|
|
19
20
|
| [`config.md`](./config.md) | `mermaidConfig`, YAML frontmatter, and init directives. |
|
|
20
21
|
| [`features.md`](./features.md) | Capability inventory. |
|
package/docs/browser.md
ADDED
|
@@ -0,0 +1,491 @@
|
|
|
1
|
+
# Browser and static sites
|
|
2
|
+
|
|
3
|
+
Two supported ways to get a diagram onto a web page. Pick by one question: **is
|
|
4
|
+
the diagram source known before the page is served?**
|
|
5
|
+
|
|
6
|
+
| Your case | Use | JS shipped |
|
|
7
|
+
|---|---|---|
|
|
8
|
+
| Source is fixed at publish time — blog post, docs page, README | [Pre-render before delivery](#framework-neutral-pre-rendering) | none |
|
|
9
|
+
| Source is authored or edited in the page — editor, playground, user input | [Async family-loaded renderer](#async-family-loaded-esm) | 41 KB initial; 162 KB for a first Timeline render, gzip |
|
|
10
|
+
| One classic script with a synchronous global matters more than transfer | [Compatibility bundle](#classic-one-file-compatibility-bundle) | 896 KB gzip |
|
|
11
|
+
|
|
12
|
+
Most sites are the first row. `renderMermaidSVG` is synchronous and needs no DOM,
|
|
13
|
+
so a static site never has to ship the renderer to a reader.
|
|
14
|
+
|
|
15
|
+
## Framework-neutral pre-rendering
|
|
16
|
+
|
|
17
|
+
Pre-rendering is not tied to Alpine, React, or any other UI framework. The
|
|
18
|
+
integration boundary is a pure function:
|
|
19
|
+
|
|
20
|
+
```txt
|
|
21
|
+
Mermaid source + explicit render options -> secured inline SVG
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Call that function wherever content becomes publishable: a static-site build
|
|
25
|
+
hook, Markdown transform, server-rendered route, CMS publish job, or cached
|
|
26
|
+
first request. The framework-specific adapter only decides how to pass source
|
|
27
|
+
in and how to mark the renderer's result as trusted markup.
|
|
28
|
+
|
|
29
|
+
### 1. Define one renderer for the whole site
|
|
30
|
+
|
|
31
|
+
Use CSS custom properties when light and dark mode change only the palette. One
|
|
32
|
+
SVG then serves both modes, so the page ships neither the renderer nor a second
|
|
33
|
+
copy of the diagram:
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
// lib/render-diagram.ts
|
|
37
|
+
import { renderMermaidSVG, type RenderOptions } from 'agentic-mermaid'
|
|
38
|
+
|
|
39
|
+
const webDiagramOptions = {
|
|
40
|
+
bg: 'var(--diagram-bg)',
|
|
41
|
+
fg: 'var(--diagram-fg)',
|
|
42
|
+
line: 'var(--diagram-line)',
|
|
43
|
+
accent: 'var(--diagram-accent)',
|
|
44
|
+
muted: 'var(--diagram-muted)',
|
|
45
|
+
surface: 'var(--diagram-surface)',
|
|
46
|
+
border: 'var(--diagram-border)',
|
|
47
|
+
font: 'Inter, system-ui, sans-serif',
|
|
48
|
+
embedFontImport: false,
|
|
49
|
+
security: 'strict',
|
|
50
|
+
} satisfies RenderOptions
|
|
51
|
+
|
|
52
|
+
export function renderDiagram(source: string): string {
|
|
53
|
+
return renderMermaidSVG(source, webDiagramOptions)
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Keep geometry-affecting options such as font, padding, wrapping width, and the
|
|
58
|
+
Look part of a Style fixed in that function. This makes output deterministic
|
|
59
|
+
and prevents a theme toggle from invalidating the layout that was measured at
|
|
60
|
+
render time.
|
|
61
|
+
|
|
62
|
+
### 2. Render at the content boundary
|
|
63
|
+
|
|
64
|
+
The call is the same in any framework or template system:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
const diagramSvg = renderDiagram(article.diagramSource)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Place `diagramSvg` inside a wrapper using the framework's reviewed safe-HTML
|
|
71
|
+
escape hatch. Trust only the result of `renderDiagram`; never mark the original
|
|
72
|
+
Mermaid source, an arbitrary SVG string, or a client-supplied cache entry as
|
|
73
|
+
safe. If the source is user-authored, retain `security: 'strict'` and enforce
|
|
74
|
+
normal request/body limits before rendering.
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<figure class="mermaid-diagram">
|
|
78
|
+
<!-- insert diagramSvg here as trusted server/build output -->
|
|
79
|
+
</figure>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The adapter belongs to the application because frameworks deliberately use
|
|
83
|
+
different trusted-markup types. The rendering policy above remains shared.
|
|
84
|
+
|
|
85
|
+
Alpine can own surrounding UI without owning rendering. For example, a server
|
|
86
|
+
or build step can replace the illustrative `{{ diagramSvg | safe }}` expression
|
|
87
|
+
with the reviewed result from `renderDiagram`:
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<div x-data="{ dark: false }" :class="{ dark }">
|
|
91
|
+
<button type="button" @click="dark = !dark">Toggle diagram palette</button>
|
|
92
|
+
<figure class="mermaid-diagram">
|
|
93
|
+
{{ diagramSvg | safe }}
|
|
94
|
+
</figure>
|
|
95
|
+
</div>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
That Alpine component toggles inherited CSS variables; it does not ship or run
|
|
99
|
+
Agentic Mermaid in the reader's browser. The same pattern works with React,
|
|
100
|
+
Vue, Svelte, server templates, or plain HTML.
|
|
101
|
+
|
|
102
|
+
### 3. Let the page own the palette
|
|
103
|
+
|
|
104
|
+
```css
|
|
105
|
+
.mermaid-diagram {
|
|
106
|
+
--diagram-bg: #ffffff;
|
|
107
|
+
--diagram-fg: #27272a;
|
|
108
|
+
--diagram-line: #71717a;
|
|
109
|
+
--diagram-accent: #2563eb;
|
|
110
|
+
--diagram-muted: #52525b;
|
|
111
|
+
--diagram-surface: #f4f4f5;
|
|
112
|
+
--diagram-border: #a1a1aa;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.dark .mermaid-diagram { /* replace `.dark` with the site's theme selector */
|
|
116
|
+
--diagram-bg: #18181b;
|
|
117
|
+
--diagram-fg: #f4f4f5;
|
|
118
|
+
--diagram-line: #a1a1aa;
|
|
119
|
+
--diagram-accent: #60a5fa;
|
|
120
|
+
--diagram-muted: #d4d4d8;
|
|
121
|
+
--diagram-surface: #27272a;
|
|
122
|
+
--diagram-border: #71717a;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.mermaid-diagram > svg {
|
|
126
|
+
display: block;
|
|
127
|
+
height: auto;
|
|
128
|
+
max-width: 100%;
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Changing these inherited properties updates the inline SVG without Alpine,
|
|
133
|
+
JavaScript, a mutation observer, or a re-render.
|
|
134
|
+
|
|
135
|
+
### 4. Put it in the right lifecycle
|
|
136
|
+
|
|
137
|
+
| Content lifecycle | Adapter location | Cache policy |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| Files in a repository | Markdown/static-site build transform | Build artifact |
|
|
140
|
+
| Server-rendered application | Server component, loader, or template helper | Memoize by render key |
|
|
141
|
+
| CMS content | Publish webhook/job; first request is a fallback | Store SVG or cache by render key |
|
|
142
|
+
| Browser editor or user input that must preview immediately | [Browser renderer](#browser-bundle) | Cache loaded runtime chunks |
|
|
143
|
+
|
|
144
|
+
A render key should cover the exact source bytes, Agentic Mermaid version,
|
|
145
|
+
render options, and any external Style definition. Do not include the active
|
|
146
|
+
light/dark palette values when they are supplied by CSS variables: they do not
|
|
147
|
+
change the SVG artifact. Invalidate stored SVG when any covered input changes.
|
|
148
|
+
|
|
149
|
+
### When to emit two SVGs
|
|
150
|
+
|
|
151
|
+
Use two pre-rendered variants only when the modes intentionally change geometry
|
|
152
|
+
or renderer behavior: for example different fonts, wrapping widths, padding,
|
|
153
|
+
or Looks such as crisp versus hand-drawn. Render each variant with fixed
|
|
154
|
+
options and let CSS choose between them. A palette-only theme toggle should use
|
|
155
|
+
one SVG and CSS variables as above.
|
|
156
|
+
|
|
157
|
+
### CLI-only build
|
|
158
|
+
|
|
159
|
+
For a site without a JavaScript build script, generate files directly:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
am render diagram.mmd --format svg --style zinc-light --output dist/diagram-light.svg
|
|
163
|
+
am render diagram.mmd --format svg --style zinc-dark --output dist/diagram-dark.svg
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Inline or include those files through the site's normal asset pipeline. The
|
|
167
|
+
diagram works with JavaScript disabled and in consumers such as RSS readers
|
|
168
|
+
that never execute the application runtime.
|
|
169
|
+
|
|
170
|
+
## Browser bundle
|
|
171
|
+
|
|
172
|
+
When the source is not known until the page runs, use one of the two browser
|
|
173
|
+
artifacts below. Both use the same renderer and final SVG security boundary.
|
|
174
|
+
|
|
175
|
+
### Async family-loaded ESM
|
|
176
|
+
|
|
177
|
+
This is the default for editors, playgrounds, and user-authored previews in
|
|
178
|
+
modern browsers. It is framework-neutral: the package exposes one async
|
|
179
|
+
function, and native ESM loads the selected family on demand.
|
|
180
|
+
|
|
181
|
+
```js
|
|
182
|
+
import { renderMermaidSVGAsync } from 'agentic-mermaid/browser/lazy'
|
|
183
|
+
|
|
184
|
+
const svg = await renderMermaidSVGAsync(source, {
|
|
185
|
+
style: 'zinc-dark',
|
|
186
|
+
security: 'strict',
|
|
187
|
+
})
|
|
188
|
+
const parsed = new DOMParser().parseFromString(svg, 'image/svg+xml')
|
|
189
|
+
if (parsed.querySelector('parsererror') || parsed.documentElement.localName !== 'svg') {
|
|
190
|
+
throw new Error('renderer returned invalid SVG')
|
|
191
|
+
}
|
|
192
|
+
document.querySelector('#diagram').replaceChildren(
|
|
193
|
+
document.importNode(parsed.documentElement, true),
|
|
194
|
+
)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Without a bundler, import the emitted ESM entry directly. Its relative dynamic
|
|
198
|
+
imports resolve to the adjacent family chunks on unpkg or a self-hosted origin:
|
|
199
|
+
|
|
200
|
+
```html
|
|
201
|
+
<script type="module">
|
|
202
|
+
import { renderMermaidSVGAsync } from
|
|
203
|
+
'https://unpkg.com/agentic-mermaid@0.3.1/dist/browser-lazy/index.js'
|
|
204
|
+
// call renderMermaidSVGAsync(...) as above
|
|
205
|
+
</script>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
An Alpine adapter only changes who supplies the source and when the pure async
|
|
209
|
+
function runs. It should still insert parsed XML nodes rather than assigning
|
|
210
|
+
`innerHTML`:
|
|
211
|
+
|
|
212
|
+
```html
|
|
213
|
+
<div x-data="diagramPreview" x-init="draw()">
|
|
214
|
+
<textarea x-model="source" @input.debounce.150ms="draw()"></textarea>
|
|
215
|
+
<p x-text="status" role="status"></p>
|
|
216
|
+
<div x-ref="output"></div>
|
|
217
|
+
</div>
|
|
218
|
+
<script type="module">
|
|
219
|
+
import Alpine from 'alpinejs'
|
|
220
|
+
import { renderMermaidSVGAsync } from 'agentic-mermaid/browser/lazy'
|
|
221
|
+
|
|
222
|
+
Alpine.data('diagramPreview', () => ({
|
|
223
|
+
source: 'timeline\n 2026 : Ship',
|
|
224
|
+
status: '',
|
|
225
|
+
generation: 0,
|
|
226
|
+
async draw() {
|
|
227
|
+
const generation = ++this.generation
|
|
228
|
+
this.status = 'rendering'
|
|
229
|
+
try {
|
|
230
|
+
const svg = await renderMermaidSVGAsync(this.source, { security: 'strict' })
|
|
231
|
+
if (generation !== this.generation) return
|
|
232
|
+
const doc = new DOMParser().parseFromString(svg, 'image/svg+xml')
|
|
233
|
+
if (doc.querySelector('parsererror') || doc.documentElement.localName !== 'svg') {
|
|
234
|
+
throw new Error('renderer returned invalid SVG')
|
|
235
|
+
}
|
|
236
|
+
this.$refs.output.replaceChildren(document.importNode(doc.documentElement, true))
|
|
237
|
+
this.status = 'rendered'
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (generation !== this.generation) return
|
|
240
|
+
this.status = `render failed: ${error}`
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
}))
|
|
244
|
+
Alpine.start()
|
|
245
|
+
</script>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
This complete bootstrap registers the component before Alpine starts, so it
|
|
249
|
+
cannot miss the `alpine:init` lifecycle event. In an application that already
|
|
250
|
+
owns Alpine startup, register `Alpine.data(...)` in that existing pre-start
|
|
251
|
+
bootstrap instead. Agentic Mermaid does not depend on Alpine; this is only an
|
|
252
|
+
adapter example.
|
|
253
|
+
Loaded modules are cached by the browser, so repeated renders do not re-fetch a
|
|
254
|
+
family or ELK.
|
|
255
|
+
|
|
256
|
+
### Classic one-file compatibility bundle
|
|
257
|
+
|
|
258
|
+
Use the prebuilt IIFE when a single classic script and synchronous global are
|
|
259
|
+
requirements. This file needs no ESM support, bundler, or import map:
|
|
260
|
+
|
|
261
|
+
```html
|
|
262
|
+
<script
|
|
263
|
+
src="https://unpkg.com/agentic-mermaid@0.3.1/dist/browser.global.js"
|
|
264
|
+
integrity="sha384-gBg9BeQORQqph8GL4oWD6yHJhhlHLkcKJrQ2OegmybQkqE7WiEtayrchfxPTZ61k"
|
|
265
|
+
crossorigin="anonymous"></script>
|
|
266
|
+
<script>
|
|
267
|
+
const svg = agenticMermaid.renderMermaidSVG('timeline\n title Roadmap\n 2026 : Ship', {
|
|
268
|
+
style: 'zinc-dark',
|
|
269
|
+
security: 'strict',
|
|
270
|
+
})
|
|
271
|
+
const parsed = new DOMParser().parseFromString(svg, 'image/svg+xml')
|
|
272
|
+
if (parsed.querySelector('parsererror') || parsed.documentElement.localName !== 'svg') {
|
|
273
|
+
throw new Error('renderer returned invalid SVG')
|
|
274
|
+
}
|
|
275
|
+
document.querySelector('#diagram').replaceChildren(
|
|
276
|
+
document.importNode(parsed.documentElement, true),
|
|
277
|
+
)
|
|
278
|
+
</script>
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The global is **`agenticMermaid`** and carries the same render surface as the
|
|
282
|
+
package entry — `renderMermaidSVG`, `renderMermaidASCII`, style helpers.
|
|
283
|
+
|
|
284
|
+
The repository's generated `/demo/` page is a vanilla-JavaScript integration
|
|
285
|
+
test, not an Alpine application. It loads the lazy ESM graph and proves through
|
|
286
|
+
browser request assertions that its Timeline render fetches neither ELK nor the
|
|
287
|
+
classic all-family artifact. The Alpine examples in this recipe are optional
|
|
288
|
+
adapters around the same framework-neutral rendering contract. The classic
|
|
289
|
+
artifact remains covered separately by the all-family browser contract.
|
|
290
|
+
|
|
291
|
+
Keep `security: 'strict'` for authored or user-provided source, and insert the
|
|
292
|
+
accepted result as parsed XML nodes as shown above. Do not assign renderer output
|
|
293
|
+
to `innerHTML`: strict rendering and DOM insertion are separate trust boundaries.
|
|
294
|
+
The integrity value pins the reviewed bytes as well as the version. When the
|
|
295
|
+
package version changes, recompute it with:
|
|
296
|
+
|
|
297
|
+
```bash
|
|
298
|
+
openssl dgst -sha384 -binary dist/browser.global.js | openssl base64 -A
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
For a strict Content Security Policy, either self-host the bundle under
|
|
302
|
+
`script-src 'self'` or allow the pinned CDN origin (for example
|
|
303
|
+
`script-src 'self' https://unpkg.com`). Put the initializer in an external
|
|
304
|
+
same-origin file, or authorize it with a nonce or hash; do not add
|
|
305
|
+
`'unsafe-inline'` just for this example.
|
|
306
|
+
|
|
307
|
+
**The bundle has shipped since v0.3.0; the reviewed bytes above are v0.3.1.**
|
|
308
|
+
Earlier releases are ESM-only and have no `dist/browser.global.js`, so those
|
|
309
|
+
versioned URLs 404. Pin a version and its matching integrity value as above
|
|
310
|
+
rather than tracking `latest`: it also stops a future release from changing the
|
|
311
|
+
file under a page you are not watching.
|
|
312
|
+
|
|
313
|
+
### Browser support
|
|
314
|
+
|
|
315
|
+
**Chrome 97, Firefox 104, Safari 15.4, Edge 97** and newer.
|
|
316
|
+
|
|
317
|
+
`Array.prototype.findLast` sets that floor. It is a runtime method, so lowering
|
|
318
|
+
the build target will not help: esbuild rewrites syntax and leaves method calls
|
|
319
|
+
as they are. The bundle also calls `Array.prototype.at`, `Object.hasOwn`, and
|
|
320
|
+
`String.prototype.replaceAll`, all of which ship earlier than `findLast`. To
|
|
321
|
+
support older browsers, load polyfills for those four before the bundle.
|
|
322
|
+
|
|
323
|
+
CI runs the contract against the current Playwright Chromium, Firefox, and
|
|
324
|
+
WebKit engines. The historical version floors above are derived from runtime API
|
|
325
|
+
availability; this project does not execute those legacy browser releases in CI.
|
|
326
|
+
|
|
327
|
+
The bundle contains no WebAssembly and makes no network request at load, so it
|
|
328
|
+
works offline and needs no cross-origin isolation.
|
|
329
|
+
|
|
330
|
+
**If you already run a bundler, do not use the classic file merely as an input
|
|
331
|
+
to that bundler.** For an async preview, keep the lazy boundary explicit:
|
|
332
|
+
|
|
333
|
+
```js
|
|
334
|
+
import { renderMermaidSVGAsync } from 'agentic-mermaid/browser/lazy'
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
The root ESM import is the complete synchronous API and should not be treated
|
|
338
|
+
as a small per-family browser build.
|
|
339
|
+
|
|
340
|
+
### Weight
|
|
341
|
+
|
|
342
|
+
Measured after the production build; compressed totals sum each fetched file
|
|
343
|
+
independently, matching HTTP transfer rather than compressing concatenated
|
|
344
|
+
chunks as one imaginary response:
|
|
345
|
+
|
|
346
|
+
| Cold path | Raw | gzip | Brotli |
|
|
347
|
+
|---|---:|---:|---:|
|
|
348
|
+
| Lazy entry before a render | 128 KB | 41 KB | 37 KB |
|
|
349
|
+
| Lazy entry + first Timeline render (non-ELK) | 529 KB | 162 KB | 143 KB |
|
|
350
|
+
| Lazy entry + first Flowchart render (ELK) | 2.17 MB | 661 KB | 529 KB |
|
|
351
|
+
| Classic all-in-one compatibility file | 2.99 MB | 896 KB | 705 KB |
|
|
352
|
+
|
|
353
|
+
For the Timeline used by the live demo, the family-loaded path cuts cold
|
|
354
|
+
gzip transfer by about **82%**. ELK-backed diagrams save less because layout is
|
|
355
|
+
the dominant cost, but they still avoid unrelated families and reuse one ELK
|
|
356
|
+
download. Run `bun run scripts/build/browser-lazy-report.ts --json` for the
|
|
357
|
+
recorded budget and request count of every family.
|
|
358
|
+
|
|
359
|
+
Before BUILD-31, `/demo/` loaded the 2,984,829 raw / 895,155 gzip / 704,945
|
|
360
|
+
Brotli-byte classic bundle. It now uses the lazy Timeline path: 529,673 raw /
|
|
361
|
+
162,026 gzip / 143,043 Brotli renderer bytes on the first render. That removes
|
|
362
|
+
733,129 gzip bytes, an **81.9%** reduction. The current classic compatibility
|
|
363
|
+
artifact is still available at 2,986,062 raw / 896,741 gzip / 705,889 Brotli
|
|
364
|
+
bytes and is tested separately.
|
|
365
|
+
|
|
366
|
+
### All-family browser delivery architecture
|
|
367
|
+
|
|
368
|
+
`agentic-mermaid/browser/lazy` implements the split below. The existing
|
|
369
|
+
`browser.global.js` remains the synchronous, self-contained compatibility
|
|
370
|
+
artifact and therefore still contains every registered family, ASCII renderer,
|
|
371
|
+
Style backend, and ELK.
|
|
372
|
+
|
|
373
|
+
The smaller entry is asynchronous and split by capability:
|
|
374
|
+
|
|
375
|
+
```txt
|
|
376
|
+
small browser entry
|
|
377
|
+
-> source-envelope normalizer + family catalog
|
|
378
|
+
-> selected family runtime chunk
|
|
379
|
+
-> shared SVG/Scene/style/security core
|
|
380
|
+
-> shared ELK chunk, only for ELK-backed families
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
That design supports every registered built-in family without making every page
|
|
384
|
+
pay for every built-in family. A page with several diagrams downloads the common
|
|
385
|
+
core once, each family runtime at most once, and ELK only if a selected family
|
|
386
|
+
needs it. Runtime-installed extension families continue to use the full package
|
|
387
|
+
entry; the closed lazy catalog cannot infer a third party's module URL.
|
|
388
|
+
|
|
389
|
+
The implementation uses real dependency boundaries rather than a second entry
|
|
390
|
+
file around the root export:
|
|
391
|
+
|
|
392
|
+
1. **Separate catalog from runtime hooks.** Family ids, header detection,
|
|
393
|
+
maturity, capabilities, and canonical examples must live in a browser-safe
|
|
394
|
+
catalog that imports no parser, layout, SVG, ASCII, or agent hooks. Today the
|
|
395
|
+
complete registry imports those hooks, which pulls the whole graph into a
|
|
396
|
+
nominally render-only bundle.
|
|
397
|
+
2. **Keep one source-normalization authority.** The loader must handle BOMs,
|
|
398
|
+
frontmatter, init directives, comments, and accessibility directives with
|
|
399
|
+
the same contract as server rendering. Refactor that contract so detection
|
|
400
|
+
can use catalog metadata; do not introduce a second regex-only browser
|
|
401
|
+
parser whose classification can drift.
|
|
402
|
+
3. **Use an exhaustive literal loader manifest.** Map every built-in family id
|
|
403
|
+
to `() => import(...)`, checked against the catalog's `BuiltinFamilyId` type.
|
|
404
|
+
Literal imports let bundlers produce chunks; exhaustiveness makes adding a
|
|
405
|
+
family fail CI until its browser runtime is enrolled.
|
|
406
|
+
4. **Make the family runtime SVG-specific.** Its contract needs request
|
|
407
|
+
normalization, layout, Scene lowering or crisp SVG rendering, and
|
|
408
|
+
diagnostics. Leave ASCII, PNG rasterization, structured mutation,
|
|
409
|
+
verification, and agent examples out of this browser entry unless a caller
|
|
410
|
+
explicitly imports those capabilities.
|
|
411
|
+
5. **Share expensive engines by need, not by family.** ELK should be one cached
|
|
412
|
+
async chunk used by the ELK-backed families, not duplicated into each family
|
|
413
|
+
chunk. Non-ELK families should have no path to it.
|
|
414
|
+
6. **Preserve output parity and security.** The lazy result must be byte-for-byte
|
|
415
|
+
equivalent to the existing renderer for the same resolved request and pass
|
|
416
|
+
through the same final SVG security policy. Loading code later must not
|
|
417
|
+
create a second rendering implementation.
|
|
418
|
+
|
|
419
|
+
The public shape is the SVG-only
|
|
420
|
+
`renderMermaidSVGAsync(source, options): Promise<string>`. The full
|
|
421
|
+
classic-script global remains available for users who value one synchronous
|
|
422
|
+
file over transfer size; there is no combinatorial bundle per family.
|
|
423
|
+
|
|
424
|
+
The acceptance gate checks the network graph, not just a smaller entry
|
|
425
|
+
filename:
|
|
426
|
+
|
|
427
|
+
- one canonical example from every registered built-in family renders with exact parity;
|
|
428
|
+
- a non-ELK example fetches no ELK chunk;
|
|
429
|
+
- two ELK-backed families reuse one ELK chunk;
|
|
430
|
+
- adding a registered built-in family without a loader is a type/test failure;
|
|
431
|
+
- initial and per-family request-count, raw, gzip, and Brotli budgets are
|
|
432
|
+
recorded separately.
|
|
433
|
+
|
|
434
|
+
`bun run build:browser:lazy` generates the exhaustive catalog, builds the
|
|
435
|
+
chunks, and fails on dependency or size drift. `bun test
|
|
436
|
+
src/__tests__/browser-lazy.test.ts` proves all-family byte parity in-process;
|
|
437
|
+
`bun test e2e/browser-bundle.e2e.test.ts --timeout 600000` proves the emitted
|
|
438
|
+
HTTP module graph, strict-mode parity, non-ELK exclusion, and shared ELK caching
|
|
439
|
+
in Chromium.
|
|
440
|
+
|
|
441
|
+
CSS-variable theming stays above this loading design. A palette toggle still
|
|
442
|
+
changes one SVG without re-rendering; code splitting solves authoring-time
|
|
443
|
+
renderer cost, not theming.
|
|
444
|
+
|
|
445
|
+
### Self-hosting it
|
|
446
|
+
|
|
447
|
+
unpkg and jsDelivr already do the right thing. If you serve the file yourself,
|
|
448
|
+
send `Content-Type: text/javascript; charset=utf-8`, and compress it — 2.99 MB
|
|
449
|
+
uncompressed against 896 KB gzipped is the difference your readers pay.
|
|
450
|
+
|
|
451
|
+
Declare the encoding in at least one of the two places. The bundle contains
|
|
452
|
+
non-ASCII characters inside a Unicode character class, and a classic
|
|
453
|
+
`<script src>` whose response omits `charset` is decoded using the host
|
|
454
|
+
document's encoding. If neither the response nor the page says UTF-8, the
|
|
455
|
+
browser picks a legacy encoding and the file throws
|
|
456
|
+
|
|
457
|
+
```txt
|
|
458
|
+
SyntaxError: Invalid regular expression: Range out of order in character class
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
before any of your code runs, with nothing in the stack trace pointing at the
|
|
462
|
+
encoding. A page with `<meta charset="utf-8">` is already safe; a hand-written
|
|
463
|
+
page with no `<head>` metadata is the one that breaks.
|
|
464
|
+
|
|
465
|
+
### Rolling your own bundle
|
|
466
|
+
|
|
467
|
+
You should not need to. If you do, two traps fail quietly enough to cost an
|
|
468
|
+
afternoon:
|
|
469
|
+
|
|
470
|
+
- **Do not combine `--global-name=X` with `window.X = …` in your entry file.**
|
|
471
|
+
esbuild emits `var X = (() => { … })()`, and at top-level script scope that
|
|
472
|
+
`var` *is* `window.X`. Your assignment runs first, then the IIFE's return
|
|
473
|
+
value — `undefined`, if your entry exports nothing — overwrites it. The build
|
|
474
|
+
succeeds and the global is empty. Use `export * from 'agentic-mermaid'` in the
|
|
475
|
+
entry and let `--global-name` do the work.
|
|
476
|
+
- **`dist/` is a build artifact and is not in the git repository.** Install from
|
|
477
|
+
npm, or run `bun install && bun run build` in a clone before pointing a
|
|
478
|
+
bundler at `dist/`.
|
|
479
|
+
|
|
480
|
+
## Coming from Beautiful Mermaid
|
|
481
|
+
|
|
482
|
+
Upstream's `THEMES` export does not exist here; it was replaced by the composable
|
|
483
|
+
Style/Palette system. The theme names survive as style names:
|
|
484
|
+
|
|
485
|
+
```js
|
|
486
|
+
renderMermaidSVG(src, THEMES['zinc-dark']) // upstream
|
|
487
|
+
renderMermaidSVG(src, { style: 'zinc-dark' }) // Agentic Mermaid
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
See [`fork-differences.md`](./fork-differences.md) for the full list of
|
|
491
|
+
divergences, and [`theming.md`](./theming.md) for the Style model.
|
package/docs/fork-differences.md
CHANGED
|
@@ -56,6 +56,39 @@ renderMermaidSVG(source, {
|
|
|
56
56
|
|
|
57
57
|
A style chooses the renderer treatment — for example `hand-drawn`, `watercolor`, `publication-figure`, or `ops-schematic`. A palette-only style chooses colors — for example `github-light`, `dracula`, or a custom JSON record with `colors`. Stacks merge left to right, so agents can keep visual requests out of Mermaid source while preserving deterministic geometry.
|
|
58
58
|
|
|
59
|
+
## Migrating from upstream: every export this fork does not have
|
|
60
|
+
|
|
61
|
+
Upstream Beautiful Mermaid's entry point exports 16 names. Ten are still
|
|
62
|
+
exported here with the same meaning: `renderMermaidSVG`, `renderMermaidASCII`,
|
|
63
|
+
`renderMermaidSVGAsync`, `fromShikiTheme`, `DEFAULTS`, and the `RenderOptions`,
|
|
64
|
+
`AsciiRenderOptions`, `DiagramColors`, `MermaidGraph`, and `PositionedGraph`
|
|
65
|
+
types.
|
|
66
|
+
|
|
67
|
+
These six are not, and each fails differently. `THEMES` is the one that bites
|
|
68
|
+
hardest, because destructuring it yields `undefined` rather than an import
|
|
69
|
+
error, so the failure lands later and elsewhere.
|
|
70
|
+
|
|
71
|
+
| Upstream | Replacement | Notes |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| `THEMES` | `{ style: 'name' }` | Theme **names** survive as style names; the map does not. `THEMES['zinc-dark']` → `{ style: 'zinc-dark' }`. |
|
|
74
|
+
| `ThemeName` | `string`, validated by `knownStyles()` | Style names are open — custom styles register at runtime — so there is no closed union to import. |
|
|
75
|
+
| `parseMermaid` | `parseRegisteredMermaid` | **Different shape.** Upstream returns a `MermaidGraph` directly; this returns a result: `{ ok: true, value }` or `{ ok: false, error }`. Check `ok` instead of catching. |
|
|
76
|
+
| `renderMermaid` | `renderMermaidSVGAsync` | Upstream alias for the async SVG renderer. |
|
|
77
|
+
| `renderMermaidSync` | `renderMermaidSVG` | Upstream alias; `renderMermaidSVG` is already synchronous here. |
|
|
78
|
+
| `renderMermaidAscii` | `renderMermaidASCII` | Casing-only alias upstream. This fork exports the capitalised spelling only. |
|
|
79
|
+
|
|
80
|
+
So a `THEMES` port fails at runtime with `TypeError: Cannot read properties of
|
|
81
|
+
undefined (reading 'zinc-dark')`, while `parseMermaid` fails at import — and the
|
|
82
|
+
three aliases fail at import too, which is the easy case.
|
|
83
|
+
|
|
84
|
+
`zinc-light`, `zinc-dark`, `dracula`, `nord`, `tokyo-night`, and the rest of the
|
|
85
|
+
upstream theme names are all valid style names; `knownStyles()` lists every
|
|
86
|
+
registered one.
|
|
87
|
+
|
|
88
|
+
`src/__tests__/upstream-export-migration.test.ts` keeps this table honest: it
|
|
89
|
+
reads upstream's own type declarations and fails if an upstream export is
|
|
90
|
+
neither exported here nor documented above.
|
|
91
|
+
|
|
59
92
|
## Mermaid config and source wrappers
|
|
60
93
|
|
|
61
94
|
This fork supports Mermaid-style source wrappers before diagram headers, including:
|
package/docs/style-authoring.md
CHANGED
|
@@ -260,7 +260,7 @@ contract explicitly; no built-in compatibility default is borrowed by
|
|
|
260
260
|
```ts
|
|
261
261
|
registerBackend(backend, {
|
|
262
262
|
version: '1.0.0',
|
|
263
|
-
compatibility: { core: '^0.
|
|
263
|
+
compatibility: { core: '^0.3.0', scene: '^2.0.0' },
|
|
264
264
|
provenance: { owner: 'acme-diagrams', source: 'application-startup' },
|
|
265
265
|
})
|
|
266
266
|
```
|