agentic-mermaid 0.3.0 → 0.3.2

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/agent-core.d.ts +8 -3
  3. package/dist/agent-core.js +2 -2
  4. package/dist/agent.d.ts +2 -2
  5. package/dist/agent.js +4 -4
  6. package/dist/agentic-mermaid-mcp.js +5 -5
  7. package/dist/am.js +6 -6
  8. package/dist/browser-lazy/chunks/architecture-WMSX5L4P.js +31 -0
  9. package/dist/browser-lazy/chunks/chunk-32FWKUUV.js +1 -0
  10. package/dist/browser-lazy/chunks/chunk-5Q4S74UO.js +1 -0
  11. package/dist/browser-lazy/chunks/chunk-A7L4WWVW.js +143 -0
  12. package/dist/browser-lazy/chunks/chunk-ANTNEVJC.js +1 -0
  13. package/dist/browser-lazy/chunks/chunk-AOCFMYYH.js +4 -0
  14. package/dist/browser-lazy/chunks/chunk-CCTZFX43.js +4 -0
  15. package/dist/browser-lazy/chunks/chunk-EBPTM2RP.js +1 -0
  16. package/dist/browser-lazy/chunks/chunk-EPFMQPXX.js +1 -0
  17. package/dist/browser-lazy/chunks/chunk-EX6TP7QM.js +46 -0
  18. package/dist/browser-lazy/chunks/chunk-FFOHLPDA.js +2 -0
  19. package/dist/browser-lazy/chunks/chunk-FLD63DXE.js +2 -0
  20. package/dist/browser-lazy/chunks/chunk-GRXCKTHX.js +0 -0
  21. package/dist/browser-lazy/chunks/chunk-I6VE56S7.js +1 -0
  22. package/dist/browser-lazy/chunks/chunk-KJVNXJ5Y.js +1 -0
  23. package/dist/browser-lazy/chunks/chunk-M6BT2HIP.js +1 -0
  24. package/dist/browser-lazy/chunks/chunk-OFRMKQA6.js +1 -0
  25. package/dist/browser-lazy/chunks/chunk-P7HMSKHJ.js +1 -0
  26. package/dist/browser-lazy/chunks/chunk-PZEWZT35.js +1 -0
  27. package/dist/browser-lazy/chunks/chunk-QMZ4Y6I7.js +1 -0
  28. package/dist/browser-lazy/chunks/chunk-QYJMRNS3.js +11 -0
  29. package/dist/browser-lazy/chunks/chunk-RLS545DI.js +1 -0
  30. package/dist/browser-lazy/chunks/chunk-STQRDZ67.js +1 -0
  31. package/dist/browser-lazy/chunks/chunk-T7IJ6V4B.js +3 -0
  32. package/dist/browser-lazy/chunks/chunk-TBZAU7KC.js +7 -0
  33. package/dist/browser-lazy/chunks/chunk-TDGTBGV3.js +1 -0
  34. package/dist/browser-lazy/chunks/chunk-TEH2PRKN.js +1 -0
  35. package/dist/browser-lazy/chunks/chunk-W6Q4PHPC.js +24 -0
  36. package/dist/browser-lazy/chunks/chunk-WEUWIFG3.js +1 -0
  37. package/dist/browser-lazy/chunks/chunk-WN7SFUCZ.js +1 -0
  38. package/dist/browser-lazy/chunks/chunk-ZZECLXC3.js +1 -0
  39. package/dist/browser-lazy/chunks/class-7JRALQIM.js +9 -0
  40. package/dist/browser-lazy/chunks/er-UDCGHKBX.js +9 -0
  41. package/dist/browser-lazy/chunks/flowchart-5FP7RRIK.js +4 -0
  42. package/dist/browser-lazy/chunks/gantt-NTOIC5CW.js +28 -0
  43. package/dist/browser-lazy/chunks/gitgraph-JYAPXUIJ.js +8 -0
  44. package/dist/browser-lazy/chunks/journey-646EFIB6.js +40 -0
  45. package/dist/browser-lazy/chunks/mindmap-2SBTQHQO.js +9 -0
  46. package/dist/browser-lazy/chunks/pie-7FDXZ24K.js +19 -0
  47. package/dist/browser-lazy/chunks/quadrant-72UT4XAW.js +24 -0
  48. package/dist/browser-lazy/chunks/radar-SU7BO56J.js +32 -0
  49. package/dist/browser-lazy/chunks/render-core-Q2JWXDDL.js +12 -0
  50. package/dist/browser-lazy/chunks/sequence-5O5ET264.js +12 -0
  51. package/dist/browser-lazy/chunks/state-IWPLFQ6R.js +4 -0
  52. package/dist/browser-lazy/chunks/timeline-WJWYHH5Y.js +20 -0
  53. package/dist/browser-lazy/chunks/xychart-HHQVQA5O.js +36 -0
  54. package/dist/browser-lazy/index.d.ts +1012 -0
  55. package/dist/browser-lazy/index.js +1 -0
  56. package/dist/browser.global.js +322 -321
  57. package/dist/{chunk-WHYJLDYG.js → chunk-3D4EHVQ4.js} +47784 -47711
  58. package/dist/{chunk-AVCWKYII.js → chunk-GX7UT56Q.js} +18 -5
  59. package/dist/{chunk-UJNY65QS.js → chunk-IVN6KP3W.js} +2 -2
  60. package/dist/{chunk-HFD4MALA.js → chunk-NE6JBHSE.js} +682 -44
  61. package/dist/{chunk-3QCXO4V6.js → chunk-R5U67OIW.js} +4 -4
  62. package/dist/{chunk-GILQUGFK.js → chunk-YWKCUBQN.js} +2 -2
  63. package/dist/{index-CLwYn6Im.d.ts → index-BFg_LoZS.d.ts} +5409 -5391
  64. package/dist/index.d.ts +1 -1
  65. package/dist/index.js +1 -1
  66. package/dist/mcp-cli-XGZP6CMW.js +17 -0
  67. package/docs/README.md +1 -1
  68. package/docs/browser.md +355 -47
  69. package/docs/mcp-http-transport.md +2 -0
  70. package/package.json +17 -6
  71. package/server.json +2 -2
  72. package/dist/mcp-cli-SJVOGRA6.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-CLwYn6Im.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-BFg_LoZS.js';
package/dist/index.js CHANGED
@@ -164,7 +164,7 @@ import {
164
164
  verifyNoExternalRefs,
165
165
  verifyResourceBytes,
166
166
  verifySvgDocumentEnvelope
167
- } from "./chunk-WHYJLDYG.js";
167
+ } from "./chunk-3D4EHVQ4.js";
168
168
  export {
169
169
  ARCHITECTURE_ICON_LIMITS,
170
170
  AsciiWidthError,
@@ -0,0 +1,17 @@
1
+ import {
2
+ MCP_CLI_HELP,
3
+ MCP_FLAG_SPECS,
4
+ parseMcpCliOptions,
5
+ runMcpCli
6
+ } from "./chunk-NE6JBHSE.js";
7
+ import "./chunk-IVN6KP3W.js";
8
+ import "./chunk-YWKCUBQN.js";
9
+ import "./chunk-GX7UT56Q.js";
10
+ import "./chunk-3D4EHVQ4.js";
11
+ export {
12
+ MCP_CLI_HELP,
13
+ MCP_FLAG_SPECS,
14
+ parseMcpCliOptions,
15
+ runMcpCli
16
+ };
17
+ //# sourceMappingURL=mcp-cli-XGZP6CMW.js.map
package/docs/README.md CHANGED
@@ -15,7 +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) | Static sites and browsers: build-time pre-rendering, and the prebuilt `<script src>` bundle. |
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. |
19
19
  | [`ascii.md`](./ascii.md) | Terminal output, ASCII vs Unicode, color modes, XY charts. |
20
20
  | [`config.md`](./config.md) | `mermaidConfig`, YAML frontmatter, and init directives. |
21
21
  | [`features.md`](./features.md) | Capability inventory. |
package/docs/browser.md CHANGED
@@ -5,65 +5,263 @@ the diagram source known before the page is served?**
5
5
 
6
6
  | Your case | Use | JS shipped |
7
7
  |---|---|---|
8
- | Source is fixed at publish time — blog post, docs page, README | [Pre-render at build time](#pre-render-at-build-time) | none |
9
- | Source is authored or edited in the page — editor, playground, user input | [Browser bundle](#browser-bundle) | ~873 KB gzip |
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 |
10
11
 
11
12
  Most sites are the first row. `renderMermaidSVG` is synchronous and needs no DOM,
12
13
  so a static site never has to ship the renderer to a reader.
13
14
 
14
- ## Pre-render at build time
15
+ ## Framework-neutral pre-rendering
15
16
 
16
- Call the library from whatever already builds your site. Emit one SVG per theme
17
- and let CSS choose, so a theme toggle is instant and needs no re-render:
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:
18
34
 
19
35
  ```ts
20
- // scripts/render-diagrams.ts
21
- import { writeFileSync } from 'node:fs'
22
- import { renderMermaidSVG } from 'agentic-mermaid'
23
-
24
- const source = `timeline
25
- title History of Social Media
26
- 2002 : LinkedIn
27
- 2004 : Facebook : Google
28
- 2006 : Twitter`
29
-
30
- const light = renderMermaidSVG(source, { style: 'zinc-light' })
31
- const dark = renderMermaidSVG(source, { style: 'zinc-dark' })
32
-
33
- writeFileSync(
34
- 'dist/timeline.html',
35
- `<div class="diagram">
36
- <div class="diagram-light">${light}</div>
37
- <div class="diagram-dark">${dark}</div>
38
- </div>`,
39
- )
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>
40
96
  ```
41
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
+
42
104
  ```css
43
- .diagram-dark { display: none }
44
- .dark .diagram-light { display: none } /* `.dark` = your dark-mode class */
45
- .dark .diagram-dark { display: block }
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
+ }
46
130
  ```
47
131
 
48
- Or from the CLI, with no build script at all:
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:
49
160
 
50
161
  ```bash
51
162
  am render diagram.mmd --format svg --style zinc-light --output dist/diagram-light.svg
52
163
  am render diagram.mmd --format svg --style zinc-dark --output dist/diagram-dark.svg
53
164
  ```
54
165
 
55
- Either way the reader downloads two inline SVGs rather than a renderer, so the
56
- diagram still shows up with JavaScript disabled and inside an RSS reader.
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.
57
169
 
58
170
  ## Browser bundle
59
171
 
60
- When the source is not known until the page runs, load the prebuilt IIFE. The
61
- ESM entry would need a bundler or an import map; this file needs neither:
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:
62
260
 
63
261
  ```html
64
262
  <script
65
- src="https://unpkg.com/agentic-mermaid@0.3.0/dist/browser.global.js"
66
- integrity="sha384-YcMQSsCGfs4ZfuWkYNET2L2z0f+YNPJftR5krUhTWrHDQ9cUcsRRp5ux5zbBYKd9"
263
+ src="https://unpkg.com/agentic-mermaid@0.3.1/dist/browser.global.js"
264
+ integrity="sha384-gBg9BeQORQqph8GL4oWD6yHJhhlHLkcKJrQ2OegmybQkqE7WiEtayrchfxPTZ61k"
67
265
  crossorigin="anonymous"></script>
68
266
  <script>
69
267
  const svg = agenticMermaid.renderMermaidSVG('timeline\n title Roadmap\n 2026 : Ship', {
@@ -83,6 +281,13 @@ ESM entry would need a bundler or an import map; this file needs neither:
83
281
  The global is **`agenticMermaid`** and carries the same render surface as the
84
282
  package entry — `renderMermaidSVG`, `renderMermaidASCII`, style helpers.
85
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
+
86
291
  Keep `security: 'strict'` for authored or user-provided source, and insert the
87
292
  accepted result as parsed XML nodes as shown above. Do not assign renderer output
88
293
  to `innerHTML`: strict rendering and DOM insertion are separate trust boundaries.
@@ -99,10 +304,11 @@ For a strict Content Security Policy, either self-host the bundle under
99
304
  same-origin file, or authorize it with a nonce or hash; do not add
100
305
  `'unsafe-inline'` just for this example.
101
306
 
102
- **The bundle ships from v0.3.0.** Earlier releases are ESM-only and have no
103
- `dist/browser.global.js`, so an unversioned CDN URL 404s against them. Pin the
104
- version as above rather than tracking `latest`: it fixes that, and it stops a
105
- future major from changing the file under a page you are not watching.
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.
106
312
 
107
313
  ### Browser support
108
314
 
@@ -121,24 +327,126 @@ availability; this project does not execute those legacy browser releases in CI.
121
327
  The bundle contains no WebAssembly and makes no network request at load, so it
122
328
  works offline and needs no cross-origin isolation.
123
329
 
124
- **If you already run a bundler, do not use this file.** Import the package
125
- normally; your bundler will tree-shake, which the IIFE cannot:
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:
126
332
 
127
333
  ```js
128
- import { renderMermaidSVG } from 'agentic-mermaid'
334
+ import { renderMermaidSVGAsync } from 'agentic-mermaid/browser/lazy'
129
335
  ```
130
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
+
131
340
  ### Weight
132
341
 
133
- `dist/browser.global.js` is 2.85 MB raw, **873 KB gzip**. Most of that is the ELK
134
- layout engine. Because a page whose diagrams never change pays that cost on every
135
- cold visit for nothing, the build-time path above is the recommendation.
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.
136
444
 
137
445
  ### Self-hosting it
138
446
 
139
447
  unpkg and jsDelivr already do the right thing. If you serve the file yourself,
140
- send `Content-Type: text/javascript; charset=utf-8`, and compress it — 2.85 MB
141
- uncompressed against 873 KB gzipped is the difference your readers pay.
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.
142
450
 
143
451
  Declare the encoding in at least one of the two places. The bundle contains
144
452
  non-ASCII characters inside a Unicode character class, and a classic
@@ -4,6 +4,8 @@
4
4
 
5
5
  > Looking for a zero-setup endpoint? A **hosted** MCP already runs at `https://agentic-mermaid.dev/mcp` (`claude mcp add --transport http agentic-mermaid https://agentic-mermaid.dev/mcp`). It is a different implementation — stateless Streamable HTTP, Cloudflare-backed, tools `execute`/`describe_sdk`/`render_svg`/`render_ascii`/`render_png`/`verify`/`describe`/`mutate`/`build`, inputs capped at 64KB, and no file/URL PNG artifacts (base64 only). See the [as-built record](./project/archive/hosted-mcp-cloudflare-plan.md). Run the local server below when you need file/URL artifacts, larger inputs, offline use, or your own auth.
6
6
  >
7
+ > **Protocol versions.** The hosted endpoint is dual-era: it serves the handshake-based revisions `2024-11-05`, `2025-03-26`, `2025-06-18`, and `2025-11-25`, and the stateless `2026-07-28` revision that replaces the `initialize` handshake with per-request `_meta` and a mandatory `server/discover`. Clients need do nothing special — send whatever revision you speak in `MCP-Protocol-Version`, and an unsupported one comes back as `-32022` listing the versions we accept. One precision worth stating: `2024-11-05` here is protocol-*version* support only. A client using the 2024-11-05-era HTTP+SSE *transport* (opening with `GET` and expecting an `endpoint` event) receives 405 and cannot connect; that entry exists for Streamable HTTP clients that negotiate the older protocol version. The local server below still pins `2024-11-05`, matching its own SSE transport.
8
+ >
7
9
  > **Privacy and caching:** every hosted call (`execute`, `render_*`, `verify`, `describe`, `mutate`, `build`) sends your diagram source or code to the agentic-mermaid.dev server. Successful deterministic pure-tool results may be reused by a private server-side Workers Cache for up to 24 hours; `execute`, `mutate`, and `build` bypass it. The JSON-RPC HTTP response itself is always `cache-control: no-store`; `x-agentic-mermaid-compute-cache` reports `hit`, `miss`, `mixed`, `bypass`, or `disabled`. For diagrams that must not leave your machine, use the library, the CLI, or the local stdio/HTTP server on this page — the pipeline is fully local and needs no network.
8
10
 
9
11
  ## Which endpoint returns plain JSON?
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "agentic-mermaid",
3
3
  "mcpName": "io.github.adewale/agentic-mermaid",
4
- "version": "0.3.0",
4
+ "version": "0.3.2",
5
5
  "license": "MIT",
6
6
  "description": "Agentic Mermaid: render, verify, and safely edit Mermaid diagrams as ASCII, PNG, SVG, or structured agent workflows — with composable styles (hand-drawn, excalidraw, watercolor, or your own as JSON).",
7
7
  "type": "module",
@@ -24,6 +24,11 @@
24
24
  "default": "./dist/agent-core.js"
25
25
  },
26
26
  "./browser": "./dist/browser.global.js",
27
+ "./browser/lazy": {
28
+ "types": "./dist/browser-lazy/index.d.ts",
29
+ "import": "./dist/browser-lazy/index.js",
30
+ "default": "./dist/browser-lazy/index.js"
31
+ },
27
32
  "./style-spec.schema.json": "./docs/schemas/style-spec.schema.json",
28
33
  "./package.json": "./package.json"
29
34
  },
@@ -102,7 +107,8 @@
102
107
  "LICENSES/",
103
108
  "THIRD_PARTY_NOTICES.md",
104
109
  "README.md",
105
- "!dist/**/*.map"
110
+ "!dist/**/*.map",
111
+ "!dist/metafile-esm.json"
106
112
  ],
107
113
  "scripts": {
108
114
  "test": "bun test --coverage --timeout 30000 src/__tests__/",
@@ -121,15 +127,19 @@
121
127
  "benchmark:palette:check": "bun run eval/palette-performance/run.ts --check",
122
128
  "harvest:upstream": "bun run eval/mermaid-upstream-suite-bench/harvest.ts",
123
129
  "harvest:upstream:refresh-check": "bun run eval/mermaid-upstream-suite-bench/refresh-check.ts",
124
- "build": "tsup && bun run build:browser",
130
+ "build": "tsup && bun run build:browser && bun run build:browser:lazy",
125
131
  "build:browser": "tsup --config tsup.browser.config.ts",
132
+ "build:browser:lazy": "bun run scripts/build/clean-browser-lazy.ts && bun run generate:browser-families && tsup --config tsup.browser-lazy.config.ts && bun run check:browser-lazy",
133
+ "check:browser-lazy": "bun run scripts/build/browser-lazy-report.ts",
134
+ "generate:browser-families": "bun run scripts/build/generate-browser-family-catalog.ts",
135
+ "check:browser-families": "bun run scripts/build/generate-browser-family-catalog.ts --check",
126
136
  "build:binary": "bun build ./bin/am.ts --compile --outfile dist/am",
127
137
  "website": "bun run website/build.ts",
128
138
  "website:check": "bun run website/build.ts --check",
129
139
  "website:payload:write": "bun run scripts/site/website-payload-report.ts --write",
130
140
  "website:payload:check": "bun run scripts/site/website-payload-report.ts --check",
131
- "website:dev": "cd website && WRANGLER_SEND_METRICS=false npx --yes wrangler@latest dev --port 9095 --ip 127.0.0.1",
132
- "deploy": "bun run build && bun run website && cd website && WRANGLER_SEND_METRICS=false npx --yes wrangler@latest deploy",
141
+ "website:dev": "cd website && WRANGLER_SEND_METRICS=false ../node_modules/.bin/wrangler dev --local --host 127.0.0.1 --port 9095 --ip 127.0.0.1",
142
+ "deploy": "gh workflow run deploy-cloudflare.yml --ref main",
133
143
  "prepublishOnly": "npm run build",
134
144
  "goldens:ascii": "bun run scripts/update-ascii-goldens.ts",
135
145
  "goldens:ascii:check": "bun run scripts/update-ascii-goldens.ts --check",
@@ -217,6 +227,7 @@
217
227
  "shiki": "^3.19.0",
218
228
  "tsup": "^8.5.1",
219
229
  "typescript": "^5.9.3",
220
- "upng-js": "^2.1.0"
230
+ "upng-js": "^2.1.0",
231
+ "wrangler": "4.114.0"
221
232
  }
222
233
  }
package/server.json CHANGED
@@ -7,13 +7,13 @@
7
7
  "url": "https://github.com/adewale/agentic-mermaid",
8
8
  "source": "github"
9
9
  },
10
- "version": "0.3.0",
10
+ "version": "0.3.2",
11
11
  "websiteUrl": "https://agentic-mermaid.dev/",
12
12
  "packages": [
13
13
  {
14
14
  "registryType": "npm",
15
15
  "identifier": "agentic-mermaid",
16
- "version": "0.3.0",
16
+ "version": "0.3.2",
17
17
  "runtimeHint": "npx",
18
18
  "runtimeArguments": [
19
19
  {