Commit Graph

317 Commits

Author SHA1 Message Date
Ashish Jain
574d76c674 fixed broken test in sequence migration to antlr new strucuture 2025-09-18 12:58:43 +02:00
Ashish Jain
adab600529 fix: Add comprehensive browser compatibility for ANTLR parser
🎯 **ANTLR Parser Browser Compatibility Complete**

###  **Fixed All process.env Access Issues**
- Added browser-safe environment variable access across all ANTLR parser files
- Implemented try-catch protection around all process.env access
- Added fallback to window.MERMAID_CONFIG for browser configuration

### 🔧 **Files Updated**
- **flowParser.ts**: Browser-safe parser selection with global config support
- **antlr-parser.ts**: Protected environment access with enhanced error handling
- **FlowchartParserCore.ts**: Shared browser-safe getEnvVar() method
- **FlowchartVisitor.ts**: Uses inherited safe environment access + detailed debug logging
- **FlowchartListener.ts**: Uses inherited safe environment access
- **flowDb.ts**: Added browser-safe environment variable access for debug logging

### 🌐 **Browser Features**
- **Global Configuration**: window.MERMAID_CONFIG support for browser environments
- **Enhanced Debug Logging**: Detailed error tracking and process access detection
- **Simple Test File**: demos/simple-antlr-test.html for isolated testing
- **Error Isolation**: Comprehensive try-catch blocks with stack trace logging

### 📊 **Results**
-  **Zero ReferenceError: process is not defined** errors
-  **Full browser compatibility** with 99.1% test pass rate maintained
-  **Enhanced debugging** with detailed error tracking
-  **Production ready** ANTLR parser for browser environments

The ANTLR parser now works seamlessly in both Node.js and browser environments! 🚀
2025-09-17 18:17:23 +02:00
Ashish Jain
f623579505 feat: Complete ANTLR parser integration with 99.1% test compatibility
🎯 ANTLR Parser Migration - PRODUCTION READY!

## Major Achievements:
-  938/947 tests passing (99.1% compatibility with Jison parser)
-  Full regression testing completed successfully
-  Complete development environment integration
-  Production-ready parser implementation

## New Features:
- 🚀 ANTLR generate command integrated into build scripts
- 🛠️ Dedicated ANTLR development server with environment configuration
- 📊 Comprehensive test page for ANTLR parser validation
- 🔧 Environment variable control (USE_ANTLR_PARSER=true/false)

## Technical Improvements:
- 🎯 Advanced ANTLR 4 grammar with sophisticated patterns
- 🔍 Complex lookahead patterns for special character handling
- 📝 Semantic predicates for lexer mode transitions
- �� Custom listener architecture for flowchart model building
- 🧪 Extensive logging and debugging infrastructure

## Files Added:
- .esbuild/server-antlr.ts - ANTLR-enabled development server
- ANTLR_SETUP.md - Comprehensive setup and testing guide
- demos/flowchart-antlr-test.html - ANTLR parser test page

## Files Modified:
- package.json - Added antlr:generate and dev:antlr scripts
- packages/mermaid/package.json - Added ANTLR generation script
- .esbuild/util.ts - Environment variable replacement for browser
- packages/mermaid/src/diagrams/flowchart/parser/flowParser.ts - Parser selection logic
- packages/mermaid/src/diagrams/flowchart/parser/antlr/* - Grammar and parser improvements
- packages/mermaid/src/diagrams/flowchart/flowDb.ts - Enhanced logging

## Test Results:
- Total Tests: 947 across 15 test files
- Passing: 938 tests  (99.1%)
- Failing: 6 tests (error message format differences only)
- Skipped: 3 tests
- All functional parsing tests pass - only cosmetic error message differences remain

## Usage:
- Generate ANTLR files: pnpm antlr:generate
- Start ANTLR dev server: pnpm dev:antlr
- Test ANTLR parser: http://localhost:9000/flowchart-antlr-test.html
- Run tests: USE_ANTLR_PARSER=true npx vitest run packages/mermaid/src/diagrams/flowchart/parser/

This represents a major technical achievement in parser migration, providing a modern,
maintainable, and highly compatible replacement for the Jison parser while maintaining
near-perfect backward compatibility.
2025-09-15 22:04:06 +02:00
Sidharth Vinod
803e2e14be Merge remote-tracking branch 'upstream/develop' into advisory-fix-1
* upstream/develop: (68 commits)
  fix: sanitize addHtmlLabel in createLabel
  docs(integrations): update Tiki to Tiki Wiki CMS Groupware community in list cms/ecm to avoid confusion
  updated lock file
  #6856 Exposing elk configuration forceNodeModelOrder and considerModelOrder to the mermaid configuration
  chore: Modify changeset
  Update .changeset/strong-laws-confess.md
  fix: fallback to raw text instead of rendering empty boxes when `htmlLabels: false`
  chore: Modify changeset
  [autofix.ci] apply automated fixes
  test: Add E2E test for unsupported markdown
  Create strong-laws-confess.md
  fix: Remove data loss when unsupported markdown is encountered
  Apply suggestion from @sidharthv96
  Add changeset and integration test
  chore: update E2E timings
  Make elk not force model order, but strongly consider it instead
  chore(deps): update peter-evans/create-pull-request digest to 1310d7d
  added changeset
  Fix border style for hand drawn shapes
  test: Verify label is sanitized
  ...
2025-08-18 16:59:44 +05:30
darshanr0107
e5ea2ed0b1 Merge branch 'develop' of https://github.com/mermaid-js/mermaid into 4459-remove-beta-suffix 2025-07-16 13:38:28 +05:30
Sidharth Vinod
af47269342 Merge pull request #6615 from mermaid-js/renovate/major-all-major
fix(deps): update all major dependencies (major)
2025-07-09 20:05:52 +00:00
renovate[bot]
d3c0893937 fix(deps): update all major dependencies 2025-07-09 19:53:14 +00:00
Sidharth Vinod
ca2eca58c9 Merge branch 'develop' into sidv/packet-release
* develop: (266 commits)
  chore: update E2E timings
  docs: Update changeset
  fix: Add useful error message to test
  chore: Add treemap example
  chore: Add treemap example
  chore: Add peerDependency to @mermaid-js/examples
  Version Packages
  docs: Update changeset
  update in changeset
  updated validaor and tests to use treemap
  Updated parser to use treemap
  chore: Fail build in CI on type errors
  fix text going outside node
  Version Packages
  Updated phpbb url  to support 403 in lychee
  Updated lychee for working url phpbb.com
  resolve PR comment
  resolve PR comments
  chore: update E2E timings
  add changeset
  ...
2025-07-10 00:38:41 +05:30
darshanr0107
6686ee9253 Merge branch 'develop' into 4459-remove-beta-suffix 2025-07-01 12:34:33 +05:30
shubham-mermaid
4ee124bf91 Merge branch 'develop' into knsv-treemap 2025-06-26 13:04:47 +05:30
darshanr0107
53d27b771d Merge branch 'develop' into 4459-remove-beta-suffix 2025-06-17 15:57:40 +05:30
darshanr0107
a3d164fde8 remove beta suffix for block diagram 2025-06-17 12:43:26 +05:30
darshanr0107
9dc987b28b remove beta support for sankey diagram 2025-06-17 12:12:40 +05:30
darshanr0107
ea60525988 remove beta suffix from xyChart 2025-06-13 19:33:43 +05:30
Ashish Jain
ca80f719ea fix(timeline): ensure consistent vertical line lengths with visible arrowheads
- Fixed inconsistent vertical line lengths in timeline diagrams
- All vertical lines now extend to same depth regardless of event count
- Added sufficient padding for clear visibility of dashed lines and arrowheads
- Added comprehensive test case and demo example

Fixes #6610
2025-05-26 12:16:58 +02:00
Knut Sveidqvist
878e77acab Updates after review comments 2025-05-20 12:56:31 +02:00
Knut Sveidqvist
fe33d5fb53 Merge remote-tracking branch 'origin/develop' into knsv-treemap 2025-05-12 19:18:04 +02:00
MrCoder
107b6cae87 Upgrade @zenuml/core to v3.31.1.
It fixes the issue https://github.com/mermaid-js/mermaid-cli/issues/584 among other improvements.
2025-05-09 19:20:20 +10:00
Knut Sveidqvist
e0a075ecca Adding treemap 2025-05-07 18:16:00 +02:00
omkarht
2a10143406 Fix: Adjust ER diagram row height calculation and layout rendering 2025-05-07 20:47:15 +05:30
Sidharth Vinod
19884294bc chore: Move packet diagram out of beta 2025-04-20 14:09:27 +05:30
Josh Soref
79f010143a spelling: mobile
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-04-17 17:38:54 -04:00
Josh Soref
c81f63b462 spelling: id
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-04-17 17:38:54 -04:00
Josh Soref
08951dbbf0 spelling: delegate
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2025-04-17 17:38:54 -04:00
Thomas Di Cizerone
0f5125b5e3 🖼️ Add Radar Demo with custom opacity 2025-03-16 18:34:00 +01:00
Thomas Di Cizerone
a7f2c0bc34 🖼️ Add Radar Demo 2025-03-16 18:20:03 +01:00
Sidharth Vinod
4e17da0a30 fix: Add layout-elk in example.html 2024-11-27 15:05:40 +05:30
agokhale
193fdb225e the ELK imports break the dev playground, drop them 2024-11-13 05:16:01 -05:00
René Lombard
1d8f524913 Manually updated the classchart 2024-09-12 12:40:19 +02:00
René Lombard
cf45a35971 Updated the code to include nested namespaces for class diagrams 2024-09-09 17:20:25 +02:00
Sidharth Vinod
0edfab1048 feat: Lazy load icons
Co-authored-by: Alois Klink <alois@aloisklink.com>
2024-09-02 19:51:14 +05:30
Sidharth Vinod
7056c20cca docs: Add external icons in demos 2024-09-02 14:00:03 +05:30
Sidharth Vinod
dccd6121b1 chore: Remove aws icons from demo 2024-08-28 21:37:54 +05:30
Knut Sveidqvist
eee1be474a Merge branch 'develop' into 5367/architecture-diagram 2024-08-28 13:50:05 +02:00
NicolasNewman
95c483934d feat(arch): all non-generic icon packs are now lazy loaded 2024-08-19 17:40:12 -05:00
NicolasNewman
261aea3089 feat(er): allow multi-line relationship labels 2024-08-12 15:51:03 -05:00
NicolasNewman
880c4d4ed6 feat(arch): updated syntax & demos/docs to reflect changes 2024-07-23 15:31:11 -05:00
NicolasNewman
25609d69c4 chore(arch): changed syntax keyword from architecture -> architecture-beta 2024-07-22 09:34:36 -05:00
NicolasNewman
bde35b23f7 chore(arch): merge with develop 2024-07-06 16:24:08 -05:00
Justin
ac5c61dbd4 docs: Added demo diagram of bidirectional arrows for sequence diagrams 2024-06-21 14:16:21 +00:00
NicolasNewman
a4cf503071 chore(arch): fixed typos in demo 2024-05-22 09:26:54 -05:00
NicolasNewman
769d5660f5 feat(arch): added aws icons 2024-05-16 11:26:58 -05:00
NicolasNewman
b09dc5db67 feat(arch): implemented junction nodes 2024-05-10 10:10:19 -05:00
NicolasNewman
5b6c95cea3 feat(arch): extended parser to control how edges pass through groups 2024-05-09 14:33:44 -05:00
NicolasNewman
84f1d82aac feat(arch): implemented group icons 2024-04-18 10:03:20 -05:00
NicolasNewman
a5d3164ea4 feat(arch): edge labels implemented 2024-04-17 12:27:53 -05:00
NicolasNewman
cb302a08b8 feat(arch): converted parser from jison to langium 2024-04-15 15:42:05 -05:00
NicolasNewman
dcb1b4871f merge(arch): : Merge branch 'develop' of https://github.com/mermaid-js/mermaid into 5367/architecture-diagram 2024-04-06 22:03:46 -05:00
NicolasNewman
baa6c9e4b9 test(arch): added edge arrow demo 2024-04-06 21:55:06 -05:00
NicolasNewman
f47bbee24a feat(arch): added more demos 2024-03-31 13:54:06 -05:00