@zenuml/core 3.47.9 → 3.48.0

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 (204) hide show
  1. package/dist/cloud-icons-eHuugVSv.js.map +1 -0
  2. package/dist/zenuml.esm.mjs +2153 -2156
  3. package/dist/zenuml.esm.mjs.map +1 -0
  4. package/dist/zenuml.js +82 -82
  5. package/dist/zenuml.js.map +1 -0
  6. package/package.json +11 -1
  7. package/src/cli/zenuml.ts +1164 -0
  8. package/.agents/skills/babysit-pr/SKILL.md +0 -223
  9. package/.agents/skills/babysit-pr/agents/openai.yaml +0 -7
  10. package/.agents/skills/dia-scoring/SKILL.md +0 -139
  11. package/.agents/skills/dia-scoring/agents/openai.yaml +0 -7
  12. package/.agents/skills/dia-scoring/references/selectors-and-keys.md +0 -253
  13. package/.agents/skills/land-pr/SKILL.md +0 -120
  14. package/.agents/skills/propagate-core-release/SKILL.md +0 -205
  15. package/.agents/skills/propagate-core-release/agents/openai.yaml +0 -7
  16. package/.agents/skills/propagate-core-release/references/downstreams.md +0 -42
  17. package/.agents/skills/ship-branch/SKILL.md +0 -105
  18. package/.agents/skills/submit-branch/SKILL.md +0 -76
  19. package/.agents/skills/validate-branch/SKILL.md +0 -72
  20. package/.claude/commands/README.md +0 -162
  21. package/.claude/commands/analyze.md +0 -101
  22. package/.claude/commands/clarify.md +0 -158
  23. package/.claude/commands/code-review.md +0 -322
  24. package/.claude/commands/constitution.md +0 -73
  25. package/.claude/commands/create-docs.md +0 -309
  26. package/.claude/commands/full-context.md +0 -121
  27. package/.claude/commands/gemini-consult.md +0 -164
  28. package/.claude/commands/handoff.md +0 -146
  29. package/.claude/commands/implement.md +0 -56
  30. package/.claude/commands/plan.md +0 -43
  31. package/.claude/commands/refactor.md +0 -188
  32. package/.claude/commands/specify.md +0 -21
  33. package/.claude/commands/tasks.md +0 -62
  34. package/.claude/commands/update-docs.md +0 -314
  35. package/.claude/hooks/README.md +0 -270
  36. package/.claude/hooks/config/sensitive-patterns.json +0 -86
  37. package/.claude/hooks/gemini-context-injector.sh +0 -129
  38. package/.claude/hooks/mcp-security-scan.sh +0 -147
  39. package/.claude/hooks/notify.sh +0 -103
  40. package/.claude/hooks/setup/hook-setup.md +0 -96
  41. package/.claude/hooks/setup/settings.json.template +0 -63
  42. package/.claude/hooks/sounds/complete.wav +0 -0
  43. package/.claude/hooks/sounds/input-needed.wav +0 -0
  44. package/.claude/hooks/subagent-context-injector.sh +0 -65
  45. package/.claude/skills/babysit-pr/SKILL.md +0 -223
  46. package/.claude/skills/babysit-pr/agents/openai.yaml +0 -7
  47. package/.claude/skills/dia-scoring/SKILL.md +0 -139
  48. package/.claude/skills/dia-scoring/agents/openai.yaml +0 -7
  49. package/.claude/skills/dia-scoring/references/selectors-and-keys.md +0 -253
  50. package/.claude/skills/emoji-eval/SKILL.md +0 -187
  51. package/.claude/skills/land-pr/SKILL.md +0 -120
  52. package/.claude/skills/propagate-core-release/SKILL.md +0 -205
  53. package/.claude/skills/propagate-core-release/agents/openai.yaml +0 -7
  54. package/.claude/skills/propagate-core-release/references/downstreams.md +0 -42
  55. package/.claude/skills/ship-branch/SKILL.md +0 -105
  56. package/.claude/skills/submit-branch/SKILL.md +0 -76
  57. package/.claude/skills/validate-branch/SKILL.md +0 -72
  58. package/.claude/skills/zenuml-ux-research/SKILL.md +0 -183
  59. package/.claude/skills/zenuml-ux-research/references/assertion-catalog.md +0 -261
  60. package/.claude/skills/zenuml-ux-research/references/best-practices-overview.md +0 -56
  61. package/.claude/skills/zenuml-ux-research/references/report-template.md +0 -89
  62. package/.claude/skills/zenuml-ux-research/references/scenarios/edit-message-label.md +0 -37
  63. package/.claude/skills/zenuml-ux-research/references/scenarios/insert-message.md +0 -36
  64. package/.claude/skills/zenuml-ux-research/references/scenarios/insert-participant.md +0 -31
  65. package/.claude/skills/zenuml-ux-research/references/scenarios/rename-participant.md +0 -33
  66. package/.claude/skills/zenuml-ux-research/references/scenarios/undo-insert.md +0 -35
  67. package/.devcontainer/devcontainer.json +0 -21
  68. package/.dockerignore +0 -19
  69. package/.eslintrc.js +0 -39
  70. package/.git-blame-ignore-revs +0 -6
  71. package/.kiro/hooks/README.md +0 -38
  72. package/.kiro/hooks/session-sound-notification.js +0 -44
  73. package/.kiro/hooks/session-sound-notification.json +0 -23
  74. package/.mcp.json.example +0 -17
  75. package/.nvmrc +0 -1
  76. package/.prettierignore +0 -4
  77. package/.prettierrc +0 -1
  78. package/.specify/memory/constitution.md +0 -33
  79. package/.specify/scripts/bash/check-prerequisites.sh +0 -166
  80. package/.specify/scripts/bash/common.sh +0 -113
  81. package/.specify/scripts/bash/create-new-feature.sh +0 -97
  82. package/.specify/scripts/bash/setup-plan.sh +0 -60
  83. package/.specify/scripts/bash/update-agent-context.sh +0 -728
  84. package/.specify/templates/agent-file-template.md +0 -23
  85. package/.specify/templates/plan-template.md +0 -219
  86. package/.specify/templates/spec-template.md +0 -116
  87. package/.specify/templates/tasks-template.md +0 -127
  88. package/.storybook/main.ts +0 -25
  89. package/.storybook/preview.ts +0 -29
  90. package/.watchmanconfig +0 -3
  91. package/AGENTS.md +0 -26
  92. package/CLAUDE.md +0 -124
  93. package/DEPLOYMENT.md +0 -62
  94. package/Dockerfile +0 -36
  95. package/IMPLEMENTATION_PLAN.md +0 -163
  96. package/Integration/vanilla-js/index.html +0 -42
  97. package/MCP-ASSISTANT-RULES.md +0 -85
  98. package/README_CN.md +0 -15
  99. package/TUTORIAL.md +0 -116
  100. package/antlr/antlr-4.11.1-complete.jar +0 -0
  101. package/bun.lock +0 -1544
  102. package/bunfig.toml +0 -52
  103. package/docs/UNICODE_SUPPORT.md +0 -179
  104. package/docs/ai-context/deployment-infrastructure.md +0 -21
  105. package/docs/ai-context/docs-overview.md +0 -89
  106. package/docs/ai-context/handoff.md +0 -174
  107. package/docs/ai-context/project-structure.md +0 -160
  108. package/docs/ai-context/system-integration.md +0 -21
  109. package/docs/asciidoc/contributor.adoc +0 -54
  110. package/docs/asciidoc/create-my-own-theme.adoc +0 -149
  111. package/docs/asciidoc/images/creation-component.png +0 -0
  112. package/docs/asciidoc/images/creation-rtl.png +0 -0
  113. package/docs/asciidoc/images/message-arrow-rtl.png +0 -0
  114. package/docs/asciidoc/images/occurrence.png +0 -0
  115. package/docs/asciidoc/images/return-message-conflict.png +0 -0
  116. package/docs/asciidoc/images/shift-up-half-the-height.png +0 -0
  117. package/docs/asciidoc/images/three-layer-info-arch.png +0 -0
  118. package/docs/asciidoc/images/vertical-alignment.svg +0 -1
  119. package/docs/asciidoc/images/vertically-aligning.png +0 -0
  120. package/docs/asciidoc/index.adoc +0 -277
  121. package/docs/asciidoc/theme-debug-web-app.png +0 -0
  122. package/docs/asciidoc/tutorial.adoc +0 -22
  123. package/docs/asciidoc/user-css.png +0 -0
  124. package/docs/async-vs-sync-parser-rules.md +0 -81
  125. package/docs/divider-parser-allow-spaces.md +0 -38
  126. package/docs/highlighting-messages.md +0 -52
  127. package/docs/images/editor-sample.png +0 -0
  128. package/docs/inherited-vs-provided-from.md +0 -64
  129. package/docs/parser/Assignment.md +0 -8
  130. package/docs/parser/PARSER_IMPROVEMENTS_CC.md +0 -425
  131. package/docs/parser/grammar_review_gemini.md +0 -116
  132. package/docs/participants-function.md +0 -25
  133. package/docs/responsive-participant-margin.md +0 -52
  134. package/docs/starter.md +0 -9
  135. package/docs/superpowers/plans/2026-03-27-e2e-test-reorg.md +0 -698
  136. package/docs/superpowers/plans/2026-03-30-emoji-support.md +0 -1220
  137. package/docs/superpowers/plans/2026-03-30-self-correcting-scoring.md +0 -206
  138. package/docs/superpowers/plans/2026-04-15-keyboard-editing-on-diagram.md +0 -1992
  139. package/docs/superpowers/plans/2026-04-15-zenuml-ux-research-skill.md +0 -1452
  140. package/docs/ux-research/.gitkeep +0 -0
  141. package/docs/ux-research/2026-04-15-rename-participant.md +0 -156
  142. package/docs/ux-research/2026-04-18-insert-participant.md +0 -151
  143. package/docs/width-translate-and-offsets.md +0 -62
  144. package/docs/xss.md +0 -59
  145. package/e2e/data/compare-cases.js +0 -1090
  146. package/e2e/data/diff-algorithm.js +0 -199
  147. package/e2e/fixtures/create-message.html +0 -26
  148. package/e2e/fixtures/editable-label.html +0 -35
  149. package/e2e/fixtures/editable-span.html +0 -122
  150. package/e2e/fixtures/empty-diagram.html +0 -23
  151. package/e2e/fixtures/fixture.html +0 -31
  152. package/e2e/fixtures/insert-participant.html +0 -23
  153. package/e2e/fixtures/reorder-cross-fragment.html +0 -31
  154. package/e2e/fixtures/reorder-fragment.html +0 -29
  155. package/e2e/fixtures/reorder-message.html +0 -27
  156. package/e2e/fixtures/svg-test.html +0 -21
  157. package/e2e/fixtures/type-switch.html +0 -29
  158. package/e2e/tools/canonical-history.html +0 -908
  159. package/e2e/tools/compare-case.html +0 -371
  160. package/e2e/tools/compare.html +0 -35
  161. package/e2e/tools/native-diff-ext/background.js +0 -60
  162. package/e2e/tools/native-diff-ext/bridge.js +0 -26
  163. package/e2e/tools/native-diff-ext/content.js +0 -194
  164. package/e2e/tools/svg-preview.html +0 -56
  165. package/embed.html +0 -193
  166. package/eslint.config.mjs +0 -35
  167. package/firebase-debug.log +0 -108
  168. package/iframe-container-demo/diagram.html +0 -124
  169. package/iframe-container-demo/host.html +0 -817
  170. package/index.html +0 -771
  171. package/mermaid-zenuml-async-spa-auth.png +0 -0
  172. package/mermaid-zenuml-async-spa-auth.snapshot.md +0 -96
  173. package/newsletter/unicode-support-announcement.md +0 -134
  174. package/playground/creation.html +0 -53
  175. package/playground/message.html +0 -63
  176. package/playwright.config.ts +0 -40
  177. package/renderer.html +0 -366
  178. package/scripts/analyze-compare-case/collect-data.mjs +0 -1134
  179. package/scripts/analyze-compare-case/config.mjs +0 -102
  180. package/scripts/analyze-compare-case/geometry.mjs +0 -101
  181. package/scripts/analyze-compare-case/native-diff.mjs +0 -224
  182. package/scripts/analyze-compare-case/output.mjs +0 -74
  183. package/scripts/analyze-compare-case/panel-diff.mjs +0 -114
  184. package/scripts/analyze-compare-case/report.mjs +0 -162
  185. package/scripts/analyze-compare-case/residual-scopes.mjs +0 -347
  186. package/scripts/analyze-compare-case/scoring.mjs +0 -829
  187. package/scripts/analyze-compare-case.mjs +0 -149
  188. package/scripts/bump-version.js +0 -117
  189. package/scripts/snapshot-dual.js +0 -173
  190. package/scripts/update-snapshots.js +0 -70
  191. package/skills/dia-scoring/SKILL.md +0 -129
  192. package/skills/dia-scoring/agents/openai.yaml +0 -7
  193. package/skills/dia-scoring/references/selectors-and-keys.md +0 -253
  194. package/tailwind.config.js +0 -126
  195. package/test-compression.html +0 -274
  196. package/test-mermaid-zenuml.html +0 -57
  197. package/test-setup.ts +0 -124
  198. package/test-url-params.html +0 -192
  199. package/tsconfig.app.json +0 -31
  200. package/tsconfig.node.json +0 -24
  201. package/tsconfig.test.json +0 -9
  202. package/vite.config.lib.ts +0 -93
  203. package/vite.config.ts +0 -84
  204. package/wrangler.toml +0 -18
package/CLAUDE.md DELETED
@@ -1,124 +0,0 @@
1
- # CLAUDE.md
2
-
3
- This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
-
5
- ## Development Commands
6
-
7
- - **Start development server**: `bun dev` (runs on port 8080)
8
- - **Build library**: `bun build` (builds library with vite.config.lib.ts)
9
- - **Build site**: `bun build:site` (builds demo site with vite.config.ts)
10
- - **Run tests**: `bun run test` (runs Vitest unit tests, excluding E2E). Do NOT use `bun test` — it picks up Playwright E2E files and reports false failures.
11
- - **Run E2E tests**: `bun pw` (runs Playwright tests)
12
- - **Run E2E tests (CI)**: `bun pw:ci` (runs with GitHub reporter for CI)
13
- - **Open Playwright UI**: `bun pw:ui`
14
- - **Update Playwright snapshots**: `bun pw:update`
15
- - **Install Playwright browsers**: `bun pw:install`
16
- - **Run smoke tests**: `bun pw:smoke`
17
- - **Lint code**: `bun eslint` (runs ESLint with auto-fix)
18
- - **Format code**: `bun prettier` (runs Prettier)
19
- - **Generate ANTLR parser**: `bun antlr` (generates JavaScript parser from grammar)
20
-
21
- ## Project Architecture
22
-
23
- ZenUML is a JavaScript-based diagramming library for creating sequence diagrams from text definitions. The project has two main parts:
24
-
25
- ### 1. DSL Parser (ANTLR-based)
26
-
27
- - **Grammar files**: `src/g4/` contains ANTLR grammar definitions
28
- - **Generated parser**: `src/generated-parser/` contains generated JavaScript parser
29
- - **Parser enhancements**: `src/parser/` contains custom functionality layered on top of ANTLR
30
-
31
- ### 2. React-based Renderer
32
-
33
- - **Core entry point**: `src/core.tsx` - main library export and ZenUml class
34
- - **Component structure**: `src/components/` - React components for rendering diagrams
35
- - **Store management**: `src/store/Store.ts` - Jotai-based state management
36
- - **Positioning engine**: `src/positioning/` - algorithms for layout and positioning
37
-
38
- ### Key Components Architecture
39
-
40
- - **DiagramFrame**: Main container component that orchestrates the entire diagram
41
- - **SeqDiagram**: Core sequence diagram renderer with layers:
42
- - **LifeLineLayer**: Renders participants and their lifelines
43
- - **MessageLayer**: Renders messages and interactions between participants
44
- - **Statement components**: Individual renderers for different UML elements (interactions, fragments, etc.)
45
-
46
- ### Parser Architecture
47
-
48
- The parser uses a two-stage approach:
49
-
50
- 1. **ANTLR-generated parser**: Converts text to parse tree
51
- 2. **Custom parser layer**: Transforms parse tree into structured data for rendering
52
-
53
- Key parser modules:
54
-
55
- - **Participants.ts**: Manages participant detection and ordering
56
- - **MessageContext.ts**: Handles message parsing and context
57
- - **FrameBuilder.ts**: Builds the overall diagram structure
58
- - **Fragment handling**: Support for UML fragments (alt, opt, loop, par, etc.)
59
-
60
- ## Build System
61
-
62
- The project uses Vite with two configurations:
63
-
64
- - **vite.config.ts**: Development server and demo site build
65
- - **vite.config.lib.ts**: Library build (ESM and UMD outputs)
66
-
67
- Output formats:
68
-
69
- - **ESM**: `dist/zenuml.esm.mjs` for modern bundlers
70
- - **UMD**: `dist/zenuml.js` for browser scripts
71
-
72
- ## Testing Strategy
73
-
74
- - **Unit tests**: Vitest for parser and utility functions
75
- - **Component tests**: React Testing Library for component logic
76
- - **E2E tests**: Playwright for full integration testing with visual snapshots
77
- - **Test files**: Co-located with source files using `.spec.ts` extension
78
-
79
- ## Key Dependencies
80
-
81
- - **React 19**: UI framework
82
- - **ANTLR4**: Parser generation
83
- - **Jotai**: State management
84
- - **Tailwind CSS**: Styling framework
85
- - **html-to-image**: PNG export functionality
86
- - **Vite**: Build tool and development server
87
-
88
- ## Package Management
89
-
90
- Uses Bun as the package manager and JavaScript runtime. Bun is a fast all-in-one JavaScript runtime that includes a package manager, test runner, and bundler.
91
-
92
- ### Test Configuration
93
- - **Unit tests with Bun**: `bun test` (alias: `bun run test`) - Runs unit tests in `src/` and `test/unit/` folders (excludes `/tests` E2E folder)
94
- - **Vitest**: Tests also support Vitest for IDE integration compatibility
95
- - **E2E tests**: `bun pw` - Runs Playwright tests in `/tests` folder
96
- - **Test setup**: `test/setup.ts` configures test environment (mocks IntersectionObserver, etc.)
97
- - Tests use `vi` mocking utilities from Vitest
98
- - Test files use `.spec.ts` extension and are co-located with source files
99
-
100
- ## Bug Fix Process
101
-
102
- When starting work on a bug (especially from a GitHub issue):
103
-
104
- 1. **Reproduce first** — write a minimal test case (unit test or Playwright E2E) that demonstrates the bug. The test must fail before any code changes.
105
- 2. **Capture a baseline** — if the bug is visual, take a Playwright snapshot or screenshot of the broken state before fixing. This serves as evidence of what changed.
106
- 3. **Fix the code** — make the minimal change to fix the bug.
107
- 4. **Verify the fix** — the failing test from step 1 must now pass. All other existing tests must still pass.
108
-
109
- Never skip the reproduction step. If you can't reproduce it, you don't understand the bug well enough to fix it.
110
-
111
- ## No Speculative Codebase Claims
112
-
113
- **NEVER** claim what the codebase does, uses, or contains without first verifying by reading or grepping the code. Phrases like "if we're currently using X", "since we already have Y", or "the codebase uses Z pattern" are forbidden unless you have Read/Grep/Glob evidence from this conversation.
114
-
115
- - Before making a claim about codebase state, verify it — use a subagent (Explore) if needed.
116
- - General programming knowledge is fine. Claims about *this* codebase require evidence.
117
-
118
- ## Development Notes
119
-
120
- - The project builds both a library and a demo site
121
- - Parser generation requires Java and ANTLR4
122
- - E2E tests use visual snapshots for regression testing
123
- - The library is published as `@zenuml/core` to npm
124
- - GitHub Pages deployment is automated via GitHub Actions
package/DEPLOYMENT.md DELETED
@@ -1,62 +0,0 @@
1
- # ZenUML Web Renderer Deployment
2
-
3
- This document describes the deployment process for the ZenUML Web Renderer to Cloudflare Pages.
4
-
5
- ## Deployment Strategy
6
-
7
- - **Production**: Deploys from `main` branch to `zenuml-web-renderer` project
8
- - **Staging**: Deploys from any non-main branch to `zenuml-web-renderer-staging` project
9
-
10
- ## GitHub Actions Workflow
11
-
12
- The deployment is automated through GitHub Actions (`.github/workflows/cloudflare-pages.yml`):
13
-
14
- 1. **Triggers**:
15
- - Push to `main` or `feat/public-renderer` branches
16
- - Pull requests to `main` branch
17
- - Only when relevant files are changed (renderer.html, public/**, src/**, etc.)
18
-
19
- 2. **Build Process**:
20
- - Install dependencies with pnpm
21
- - Build the site using `pnpm build:site`
22
- - Deploy to appropriate Cloudflare Pages project
23
-
24
- ## Required Secrets
25
-
26
- Add these secrets to your GitHub repository settings:
27
-
28
- - `CLOUDFLARE_API_TOKEN`: Cloudflare API token with Pages permissions
29
- - `CLOUDFLARE_ACCOUNT_ID`: Your Cloudflare account ID
30
-
31
- ## Manual Deployment
32
-
33
- You can also deploy manually using wrangler:
34
-
35
- ```bash
36
- # Deploy to staging
37
- pnpm pages:deploy:staging
38
-
39
- # Deploy to production
40
- pnpm pages:deploy
41
- ```
42
-
43
- ## Project Structure
44
-
45
- - `renderer.html`: Main renderer page (root level)
46
- - `public/renderer.html`: Copy of renderer page for static hosting
47
- - `dist/`: Build output directory (created by `pnpm build:site`)
48
- - `wrangler.toml`: Cloudflare configuration
49
-
50
- ## URLs
51
-
52
- - **Production**: `https://zenuml-web-renderer.pages.dev`
53
- - **Staging**: `https://zenuml-web-renderer-staging.pages.dev`
54
-
55
- ## Usage
56
-
57
- Once deployed, you can use the renderer by visiting:
58
- - `https://your-domain.pages.dev/renderer.html`
59
- - `https://your-domain.pages.dev/` (if configured as index)
60
-
61
- Future URL parameter support will allow:
62
- - `https://your-domain.pages.dev/renderer.html?code=<base64-encoded-zenuml>`
package/Dockerfile DELETED
@@ -1,36 +0,0 @@
1
- FROM node:20-slim AS base
2
-
3
- # Set environment variables for pnpm
4
- ENV PNPM_HOME="/pnpm"
5
- ENV PATH="$PNPM_HOME:$PATH"
6
- ENV DOCKER=true
7
-
8
- # Enable corepack to use pnpm
9
- RUN corepack enable
10
-
11
- # Set the working directory
12
- WORKDIR /app
13
-
14
- # Copy the project files to the working directory
15
- COPY . .
16
-
17
- RUN pnpm add -g serve
18
-
19
- FROM base As prod-deps
20
- RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile --prod --ignore-scripts
21
- FROM base AS deps
22
- RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
23
-
24
- FROM base AS build
25
- COPY --from=deps /app/node_modules /app/node_modules
26
- RUN pnpm build:site
27
-
28
- FROM base
29
- COPY --from=prod-deps /app/node_modules /app/node_modules
30
- COPY --from=build /app/dist /app/dist
31
-
32
- # Expose the port the app runs on
33
- EXPOSE 8080
34
-
35
- # Command to run the application
36
- CMD ["serve", "-s", "dist", "-l", "8080"]
@@ -1,163 +0,0 @@
1
- # Implementation Plan: Named Parameters Support
2
-
3
- ## Overview
4
- Add support for named parameters in method calls, allowing syntax like `A.method(param=value)` alongside existing positional parameters.
5
-
6
- ## Current State Analysis
7
-
8
- ### Grammar Structure
9
- - **Parser**: `src/g4/sequenceParser.g4` defines parameter rules at lines 220-230
10
- - **Current parameter rule**: `parameter: declaration | expr`
11
- - **Parameters rule**: `parameters: parameter (COMMA parameter)* COMMA?`
12
- - **Invocation**: Method calls use `invocation: OPAR parameters? CPAR`
13
-
14
- ### Parser Logic
15
- - **SignatureText.ts**: Handles parameter display via `getFormattedText()`
16
- - **Parser.types.ts**: Defines `Parameter` and `Parameters` interfaces
17
- - **Current behavior**: Parameters are parsed as expressions or type declarations
18
-
19
- ## Implementation Stages
20
-
21
- ### Stage 1: Grammar Extension
22
- **Goal**: Extend ANTLR grammar to support named parameter syntax
23
- **Success Criteria**:
24
- - Grammar accepts `param=value` syntax
25
- - Backward compatibility with existing positional syntax
26
- - Parser generates successfully
27
-
28
- **Tasks**:
29
- - [x] Add `namedParameter` rule: `ID ASSIGN expr`
30
- - [x] Update `parameter` rule to include `namedParameter | declaration | expr`
31
- - [x] Add tests for grammar parsing
32
- - [x] Regenerate parser with `pnpm antlr`
33
-
34
- **Tests**:
35
- - [x] `A.method(x=1, y=2)` parses correctly
36
- - [x] `A.method(1, name="test")` mixed parameters work
37
- - [x] Existing `A.method(1, 2)` still works
38
-
39
- **Status**: Complete
40
-
41
- ### Stage 2: Parser Type Extensions
42
- **Goal**: Extend parser types and interfaces to handle named parameters
43
- **Success Criteria**:
44
- - Named parameter data accessible in parser contexts
45
- - Type definitions support both named and positional parameters
46
-
47
- **Tasks**:
48
- - [x] Extend `Parameter` interface to distinguish parameter types
49
- - [x] Add `NamedParameter` interface with name and value properties
50
- - [x] Update `SignatureText.ts` to handle named parameter formatting
51
- - [x] Update type assertions and context handling
52
-
53
- **Tests**:
54
- - [x] Named parameters accessible via parser API
55
- - [x] `getFormattedText()` displays named parameters correctly
56
- - [x] Type safety maintained
57
-
58
- **Status**: Complete
59
-
60
- ### Stage 3: Rendering Support
61
- **Goal**: Update React components to render named parameters appropriately
62
- **Success Criteria**:
63
- - Named parameters displayed in sequence diagrams
64
- - Clear visual distinction between parameter types
65
- - Consistent formatting with existing design
66
-
67
- **Tasks**:
68
- - [x] Update message rendering components (via SignatureText.ts)
69
- - [x] Enhance parameter display logic (formatParameters helper)
70
- - [x] Ensure consistent formatting with existing design
71
- - [x] Test rendering in development environment
72
-
73
- **Tests**:
74
- - [x] Named parameters render correctly: `method(userId=123,name="John")`
75
- - [x] Mixed parameters work: `method(123,name="John",active=true)`
76
- - [x] Backward compatibility maintained: `oldMethod(1,2,3)`
77
- - [x] Complex scenarios: `mixedCall("first",second=456,"third")`
78
-
79
- **Status**: Complete
80
-
81
- ### Stage 4: Test Coverage & Integration
82
- **Goal**: Comprehensive testing and integration with existing features
83
- **Success Criteria**:
84
- - Full test coverage for named parameter scenarios
85
- - E2E tests validate end-to-end functionality
86
- - No regressions in existing functionality
87
-
88
- **Tasks**:
89
- - [ ] Unit tests for parser logic
90
- - [ ] Component tests for rendering
91
- - [ ] E2E tests with Playwright
92
- - [ ] Performance regression testing
93
- - [ ] Documentation updates
94
-
95
- **Tests**:
96
- - All test suites pass
97
- - Performance benchmarks maintained
98
- - Edge cases handled properly
99
-
100
- **Status**: Not Started
101
-
102
- ### Stage 5: Documentation & Examples
103
- **Goal**: User-facing documentation and examples
104
- **Success Criteria**:
105
- - Clear documentation of named parameter syntax
106
- - Working examples in demo site
107
- - Migration guidance for users
108
-
109
- **Tasks**:
110
- - [ ] Update grammar documentation
111
- - [ ] Add examples to demo site
112
- - [ ] Update README with new syntax
113
- - [ ] API documentation updates
114
-
115
- **Tests**:
116
- - Documentation examples work correctly
117
- - Demo site renders named parameter examples
118
- - No broken links or outdated information
119
-
120
- **Status**: Not Started
121
-
122
- ## Technical Considerations
123
-
124
- ### Backward Compatibility
125
- - Existing positional parameter syntax must continue working
126
- - Mixed parameter styles (positional + named) should be supported
127
- - No breaking changes to existing APIs
128
-
129
- ### Performance Impact
130
- - Minimal impact on parser performance
131
- - Named parameter detection should be efficient
132
- - Memory usage considerations for parameter storage
133
-
134
- ### Edge Cases
135
- - Parameter name validation and uniqueness
136
- - Error handling for invalid syntax
137
- - Interaction with existing features (fragments, loops, etc.)
138
-
139
- ### Dependencies
140
- - ANTLR4 parser regeneration
141
- - No new external dependencies required
142
- - Maintain compatibility with existing build system
143
-
144
- ## Risk Assessment
145
-
146
- **Low Risk**:
147
- - Grammar extension is straightforward
148
- - Existing infrastructure supports parameter handling
149
-
150
- **Medium Risk**:
151
- - Rendering changes may require careful CSS updates
152
- - Type system changes need thorough testing
153
-
154
- **High Risk**:
155
- - Parser performance impact needs monitoring
156
- - Complex interaction with expression parsing
157
-
158
- ## Success Metrics
159
- - [ ] All existing tests pass
160
- - [ ] New functionality covered by tests
161
- - [ ] No performance degradation
162
- - [ ] Documentation complete
163
- - [ ] Community feedback positive
@@ -1,42 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <title>Integration ZenUML Library with Vanilla JavaScript</title>
6
- <script>
7
- window.process = { env: "production" };
8
- </script>
9
- <script src="https://www.unpkg.com/@zenuml/core/dist/zenuml.js"></script>
10
- </head>
11
- <body class="zenuml">
12
- <div id="app"></div>
13
- <script>
14
- const ZenUml = window["zenuml"].default;
15
- const zenuml = new ZenUml(document.getElementById("app"));
16
- const code = `
17
- A B C D
18
-
19
- A->B.method() {
20
- ret0_assign_rtl =C.method_long_to_give_space {
21
- @return C->D: ret1_annotation_ltr
22
- ret5_assign_ltr = B.method
23
- if(x) {
24
- ret0_assign_rtl =C.method_long_to_give_space {
25
- @return C->D: ret1_annotation_ltr
26
- ret5_assign_ltr = B.method
27
- }
28
- }
29
- B.method2 {
30
- return ret2_return_ltr
31
- }
32
- }
33
-
34
- return ret2_return_rtl
35
- @return B->A: ret4_annotation_rtl
36
- }
37
-
38
- `;
39
- zenuml.render(code, { theme: "theme-blue" });
40
- </script>
41
- </body>
42
- </html>
@@ -1,85 +0,0 @@
1
- # MCP Assistant Rules - [Project Name]
2
-
3
- ## Project Context
4
- [Brief description of what your project does and its main purpose. Keep it concise - 2-3 sentences max.]
5
-
6
- ### Core Vision & Architecture
7
- - **Product Goal**: [Primary goal of your product]
8
- - **Target Platform**: [Primary platform(s) - web, mobile, desktop, etc.]
9
- - **Architecture**: [High-level architecture overview]
10
- - **Key Technologies**: [Main technologies/frameworks used]
11
-
12
- ### Key Technical Principles
13
- [List 4-6 core technical principles that guide your project]
14
- - **Example**: Session-based architecture with clear boundaries
15
- - **Example**: API-first design with versioning from day one
16
- - **Example**: Security by default - validate all inputs at boundaries
17
- - **Example**: Observable systems with structured logging
18
-
19
- **Note:** The complete project structure and technology stack are provided in the attached `project-structure.md` file.
20
-
21
- ## Key Project Standards
22
-
23
- ### Core Principles
24
- [List your fundamental development principles]
25
- - Follow KISS, YAGNI, and DRY - prefer proven solutions over custom implementations
26
- - Never mock, use placeholders, or omit code - always implement fully
27
- - Be brutally honest about whether an idea is good or bad
28
- - [Add project-specific principles]
29
-
30
- ### Code Organization
31
- [Define your code organization standards]
32
- - Keep files under [X] lines - split by extracting utilities, constants, types
33
- - Single responsibility per file with clear purpose
34
- - Prefer composition over inheritance
35
- - [Add language/framework specific organization rules]
36
-
37
- ### [Language] Standards
38
- [Replace with your primary language and its standards]
39
- - Type safety requirements
40
- - Naming conventions (classes, functions, constants)
41
- - Documentation requirements (docstring style, required elements)
42
- - Error handling patterns
43
-
44
- ### Error Handling & Logging
45
- - Use specific exceptions with helpful messages
46
- - Structured logging only - define your logging approach
47
- - [Specify logging categories or patterns]
48
- - Every request needs correlation ID for tracing
49
-
50
- ### API Design
51
- [If applicable - define API standards]
52
- - RESTful with consistent URL patterns
53
- - Version from day one (/v1/, /v2/)
54
- - Consistent response format
55
- - Proper HTTP status codes
56
-
57
- ### Security & State
58
- - Never trust external inputs - validate at boundaries
59
- - [Define session/state management approach]
60
- - [Specify data retention policies]
61
- - Keep secrets in environment variables only
62
-
63
- ## Project-Specific Guidelines
64
- [Add any project-specific guidelines that AI assistants should know]
65
-
66
- ### Domain-Specific Rules
67
- [Add rules specific to your problem domain]
68
-
69
- ### Integration Points
70
- [List key integration points or external services]
71
-
72
- ### Performance Considerations
73
- [Add any performance-critical aspects]
74
-
75
- ## Important Constraints
76
- - You cannot create, modify, or execute code
77
- - You operate in a read-only support capacity
78
- - Your suggestions are for the primary AI (Claude Code) to implement
79
- - Focus on analysis, understanding, and advisory support
80
-
81
- ## Quick Reference
82
- [Add frequently needed information]
83
- - Key commands: [List common commands]
84
- - Important paths: [List critical file paths]
85
- - Documentation links: [Add links to detailed docs]
package/README_CN.md DELETED
@@ -1,15 +0,0 @@
1
- # Development
2
-
3
- ```
4
- pnpm install
5
- pnpm dev
6
- ```
7
-
8
- # 代码结构
9
-
10
- DSL 解析器和渲染器都在这个代码库中。
11
-
12
- DSL 解析器是基于 Antlr4 构建的。其定义文件位于`src/g4`。生成的解析器位于 `src/generated-parser`。
13
- 对解析器的增强相关的代码位于`src/parser`文件夹。
14
-
15
- 所有其他的文件基本上都是跟渲染器相关的。渲染器是基于 VueJs 2.x 开发的。
package/TUTORIAL.md DELETED
@@ -1,116 +0,0 @@
1
-
2
- # ZenUML Integration Tutorial
3
-
4
- This tutorial provides a comprehensive guide on how to integrate ZenUML into your applications. There are two primary methods for integration: as a library or as an embedded iframe.
5
-
6
- ## 1. As a Library
7
-
8
- This is the most flexible method, allowing for deep integration with your application.
9
-
10
- ### Installation
11
-
12
- First, add the `@zenuml/core` package to your project:
13
-
14
- ```bash
15
- npm install @zenuml/core
16
- ```
17
-
18
- or
19
-
20
- ```bash
21
- bun add @zenuml/core
22
- ```
23
-
24
- ### Usage
25
-
26
- The main entry point of the library is the `ZenUml` class. Here's a basic example of how to use it:
27
-
28
- ```javascript
29
- import ZenUml from '@zenuml/core';
30
-
31
- // 1. Get the container element
32
- const el = document.getElementById('zenuml-container');
33
-
34
- // 2. Create a new instance of ZenUml
35
- const zenUml = new ZenUml(el);
36
-
37
- // 3. Render a diagram
38
- const code = 'A->B: message';
39
- const config = {
40
- theme: 'default',
41
- };
42
- zenUml.render(code, config);
43
- ```
44
-
45
- ### Configuration
46
-
47
- The `render` method accepts a configuration object with the following properties:
48
-
49
- - `theme`: The name of the theme to use. A list of available themes can be found in the documentation.
50
- - `enableScopedTheming`: A boolean that indicates whether to scope the theme to the container element. This is useful when you have multiple diagrams on the same page with different themes.
51
- - `onThemeChange`: A callback function that is called when the theme is changed.
52
- - `enableMultiTheme`: A boolean that indicates whether to enable multi-theme support.
53
- - `stickyOffset`: A number that indicates the offset for the sticky header.
54
- - `onContentChange`: A callback function that is called when the content of the diagram is changed.
55
- - `onEventEmit`: A callback function that is called when an event is emitted from the diagram.
56
- - `mode`: The rendering mode. Can be `RenderMode.Dynamic` or `RenderMode.Static`.
57
-
58
- ### Example
59
-
60
- Here's a more advanced example that uses some of the configuration options:
61
-
62
- ```javascript
63
- import ZenUml from '@zenuml/core';
64
-
65
- const el = document.getElementById('zenuml-container');
66
- const zenUml = new ZenUml(el);
67
-
68
- const code = `
69
- // This is a comment
70
- A->B: synchronous message
71
- B-->A: asynchronous message
72
- `;
73
-
74
- const config = {
75
- theme: 'blue',
76
- enableScopedTheming: true,
77
- onContentChange: (newCode) => {
78
- console.log('Diagram code changed:', newCode);
79
- },
80
- };
81
-
82
- zenUml.render(code, config);
83
- ```
84
-
85
- ### Exporting Diagrams
86
-
87
- You can export diagrams to PNG and SVG formats. The `ZenUml` class provides the following methods for exporting:
88
-
89
- - `getPng()`: Returns a promise that resolves to a PNG data URL.
90
- - `getSvg()`: Returns a promise that resolves to an SVG data URL.
91
-
92
- Here's an example of how to use these methods:
93
-
94
- ```javascript
95
- import ZenUml from '@zenuml/core';
96
-
97
- const el = document.getElementById('zenuml-container');
98
- const zenUml = new ZenUml(el);
99
-
100
- const code = 'A->B: message';
101
-
102
- async function exportDiagram() {
103
- await zenUml.render(code, { theme: 'default' });
104
- const png = await zenUml.getPng();
105
- // Do something with the PNG data URL
106
- console.log(png);
107
-
108
- const svg = await zenUml.getSvg();
109
- // Do something with the SVG data URL
110
- console.log(svg);
111
- }
112
-
113
- exportDiagram();
114
- ```
115
-
116
- This tutorial should provide you with a solid foundation for integrating ZenUML into your applications. For more detailed information, please refer to the official documentation.
Binary file