@zenuml/core 3.47.9 → 3.48.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/cli/zenuml.mjs +13529 -0
  2. package/dist/cli/zenuml.mjs.map +1 -0
  3. package/dist/cloud-icons-eHuugVSv.js.map +1 -0
  4. package/dist/zenuml.esm.mjs +2153 -2156
  5. package/dist/zenuml.esm.mjs.map +1 -0
  6. package/dist/zenuml.js +82 -82
  7. package/dist/zenuml.js.map +1 -0
  8. package/package.json +18 -5
  9. package/.agents/skills/babysit-pr/SKILL.md +0 -223
  10. package/.agents/skills/babysit-pr/agents/openai.yaml +0 -7
  11. package/.agents/skills/dia-scoring/SKILL.md +0 -139
  12. package/.agents/skills/dia-scoring/agents/openai.yaml +0 -7
  13. package/.agents/skills/dia-scoring/references/selectors-and-keys.md +0 -253
  14. package/.agents/skills/land-pr/SKILL.md +0 -120
  15. package/.agents/skills/propagate-core-release/SKILL.md +0 -205
  16. package/.agents/skills/propagate-core-release/agents/openai.yaml +0 -7
  17. package/.agents/skills/propagate-core-release/references/downstreams.md +0 -42
  18. package/.agents/skills/ship-branch/SKILL.md +0 -105
  19. package/.agents/skills/submit-branch/SKILL.md +0 -76
  20. package/.agents/skills/validate-branch/SKILL.md +0 -72
  21. package/.claude/commands/README.md +0 -162
  22. package/.claude/commands/analyze.md +0 -101
  23. package/.claude/commands/clarify.md +0 -158
  24. package/.claude/commands/code-review.md +0 -322
  25. package/.claude/commands/constitution.md +0 -73
  26. package/.claude/commands/create-docs.md +0 -309
  27. package/.claude/commands/full-context.md +0 -121
  28. package/.claude/commands/gemini-consult.md +0 -164
  29. package/.claude/commands/handoff.md +0 -146
  30. package/.claude/commands/implement.md +0 -56
  31. package/.claude/commands/plan.md +0 -43
  32. package/.claude/commands/refactor.md +0 -188
  33. package/.claude/commands/specify.md +0 -21
  34. package/.claude/commands/tasks.md +0 -62
  35. package/.claude/commands/update-docs.md +0 -314
  36. package/.claude/hooks/README.md +0 -270
  37. package/.claude/hooks/config/sensitive-patterns.json +0 -86
  38. package/.claude/hooks/gemini-context-injector.sh +0 -129
  39. package/.claude/hooks/mcp-security-scan.sh +0 -147
  40. package/.claude/hooks/notify.sh +0 -103
  41. package/.claude/hooks/setup/hook-setup.md +0 -96
  42. package/.claude/hooks/setup/settings.json.template +0 -63
  43. package/.claude/hooks/sounds/complete.wav +0 -0
  44. package/.claude/hooks/sounds/input-needed.wav +0 -0
  45. package/.claude/hooks/subagent-context-injector.sh +0 -65
  46. package/.claude/skills/babysit-pr/SKILL.md +0 -223
  47. package/.claude/skills/babysit-pr/agents/openai.yaml +0 -7
  48. package/.claude/skills/dia-scoring/SKILL.md +0 -139
  49. package/.claude/skills/dia-scoring/agents/openai.yaml +0 -7
  50. package/.claude/skills/dia-scoring/references/selectors-and-keys.md +0 -253
  51. package/.claude/skills/emoji-eval/SKILL.md +0 -187
  52. package/.claude/skills/land-pr/SKILL.md +0 -120
  53. package/.claude/skills/propagate-core-release/SKILL.md +0 -205
  54. package/.claude/skills/propagate-core-release/agents/openai.yaml +0 -7
  55. package/.claude/skills/propagate-core-release/references/downstreams.md +0 -42
  56. package/.claude/skills/ship-branch/SKILL.md +0 -105
  57. package/.claude/skills/submit-branch/SKILL.md +0 -76
  58. package/.claude/skills/validate-branch/SKILL.md +0 -72
  59. package/.claude/skills/zenuml-ux-research/SKILL.md +0 -183
  60. package/.claude/skills/zenuml-ux-research/references/assertion-catalog.md +0 -261
  61. package/.claude/skills/zenuml-ux-research/references/best-practices-overview.md +0 -56
  62. package/.claude/skills/zenuml-ux-research/references/report-template.md +0 -89
  63. package/.claude/skills/zenuml-ux-research/references/scenarios/edit-message-label.md +0 -37
  64. package/.claude/skills/zenuml-ux-research/references/scenarios/insert-message.md +0 -36
  65. package/.claude/skills/zenuml-ux-research/references/scenarios/insert-participant.md +0 -31
  66. package/.claude/skills/zenuml-ux-research/references/scenarios/rename-participant.md +0 -33
  67. package/.claude/skills/zenuml-ux-research/references/scenarios/undo-insert.md +0 -35
  68. package/.devcontainer/devcontainer.json +0 -21
  69. package/.dockerignore +0 -19
  70. package/.eslintrc.js +0 -39
  71. package/.git-blame-ignore-revs +0 -6
  72. package/.kiro/hooks/README.md +0 -38
  73. package/.kiro/hooks/session-sound-notification.js +0 -44
  74. package/.kiro/hooks/session-sound-notification.json +0 -23
  75. package/.mcp.json.example +0 -17
  76. package/.nvmrc +0 -1
  77. package/.prettierignore +0 -4
  78. package/.prettierrc +0 -1
  79. package/.specify/memory/constitution.md +0 -33
  80. package/.specify/scripts/bash/check-prerequisites.sh +0 -166
  81. package/.specify/scripts/bash/common.sh +0 -113
  82. package/.specify/scripts/bash/create-new-feature.sh +0 -97
  83. package/.specify/scripts/bash/setup-plan.sh +0 -60
  84. package/.specify/scripts/bash/update-agent-context.sh +0 -728
  85. package/.specify/templates/agent-file-template.md +0 -23
  86. package/.specify/templates/plan-template.md +0 -219
  87. package/.specify/templates/spec-template.md +0 -116
  88. package/.specify/templates/tasks-template.md +0 -127
  89. package/.storybook/main.ts +0 -25
  90. package/.storybook/preview.ts +0 -29
  91. package/.watchmanconfig +0 -3
  92. package/AGENTS.md +0 -26
  93. package/CLAUDE.md +0 -124
  94. package/DEPLOYMENT.md +0 -62
  95. package/Dockerfile +0 -36
  96. package/IMPLEMENTATION_PLAN.md +0 -163
  97. package/Integration/vanilla-js/index.html +0 -42
  98. package/MCP-ASSISTANT-RULES.md +0 -85
  99. package/README_CN.md +0 -15
  100. package/TUTORIAL.md +0 -116
  101. package/antlr/antlr-4.11.1-complete.jar +0 -0
  102. package/bun.lock +0 -1544
  103. package/bunfig.toml +0 -52
  104. package/docs/UNICODE_SUPPORT.md +0 -179
  105. package/docs/ai-context/deployment-infrastructure.md +0 -21
  106. package/docs/ai-context/docs-overview.md +0 -89
  107. package/docs/ai-context/handoff.md +0 -174
  108. package/docs/ai-context/project-structure.md +0 -160
  109. package/docs/ai-context/system-integration.md +0 -21
  110. package/docs/asciidoc/contributor.adoc +0 -54
  111. package/docs/asciidoc/create-my-own-theme.adoc +0 -149
  112. package/docs/asciidoc/images/creation-component.png +0 -0
  113. package/docs/asciidoc/images/creation-rtl.png +0 -0
  114. package/docs/asciidoc/images/message-arrow-rtl.png +0 -0
  115. package/docs/asciidoc/images/occurrence.png +0 -0
  116. package/docs/asciidoc/images/return-message-conflict.png +0 -0
  117. package/docs/asciidoc/images/shift-up-half-the-height.png +0 -0
  118. package/docs/asciidoc/images/three-layer-info-arch.png +0 -0
  119. package/docs/asciidoc/images/vertical-alignment.svg +0 -1
  120. package/docs/asciidoc/images/vertically-aligning.png +0 -0
  121. package/docs/asciidoc/index.adoc +0 -277
  122. package/docs/asciidoc/theme-debug-web-app.png +0 -0
  123. package/docs/asciidoc/tutorial.adoc +0 -22
  124. package/docs/asciidoc/user-css.png +0 -0
  125. package/docs/async-vs-sync-parser-rules.md +0 -81
  126. package/docs/divider-parser-allow-spaces.md +0 -38
  127. package/docs/highlighting-messages.md +0 -52
  128. package/docs/images/editor-sample.png +0 -0
  129. package/docs/inherited-vs-provided-from.md +0 -64
  130. package/docs/parser/Assignment.md +0 -8
  131. package/docs/parser/PARSER_IMPROVEMENTS_CC.md +0 -425
  132. package/docs/parser/grammar_review_gemini.md +0 -116
  133. package/docs/participants-function.md +0 -25
  134. package/docs/responsive-participant-margin.md +0 -52
  135. package/docs/starter.md +0 -9
  136. package/docs/superpowers/plans/2026-03-27-e2e-test-reorg.md +0 -698
  137. package/docs/superpowers/plans/2026-03-30-emoji-support.md +0 -1220
  138. package/docs/superpowers/plans/2026-03-30-self-correcting-scoring.md +0 -206
  139. package/docs/superpowers/plans/2026-04-15-keyboard-editing-on-diagram.md +0 -1992
  140. package/docs/superpowers/plans/2026-04-15-zenuml-ux-research-skill.md +0 -1452
  141. package/docs/ux-research/.gitkeep +0 -0
  142. package/docs/ux-research/2026-04-15-rename-participant.md +0 -156
  143. package/docs/ux-research/2026-04-18-insert-participant.md +0 -151
  144. package/docs/width-translate-and-offsets.md +0 -62
  145. package/docs/xss.md +0 -59
  146. package/e2e/data/compare-cases.js +0 -1090
  147. package/e2e/data/diff-algorithm.js +0 -199
  148. package/e2e/fixtures/create-message.html +0 -26
  149. package/e2e/fixtures/editable-label.html +0 -35
  150. package/e2e/fixtures/editable-span.html +0 -122
  151. package/e2e/fixtures/empty-diagram.html +0 -23
  152. package/e2e/fixtures/fixture.html +0 -31
  153. package/e2e/fixtures/insert-participant.html +0 -23
  154. package/e2e/fixtures/reorder-cross-fragment.html +0 -31
  155. package/e2e/fixtures/reorder-fragment.html +0 -29
  156. package/e2e/fixtures/reorder-message.html +0 -27
  157. package/e2e/fixtures/svg-test.html +0 -21
  158. package/e2e/fixtures/type-switch.html +0 -29
  159. package/e2e/tools/canonical-history.html +0 -908
  160. package/e2e/tools/compare-case.html +0 -371
  161. package/e2e/tools/compare.html +0 -35
  162. package/e2e/tools/native-diff-ext/background.js +0 -60
  163. package/e2e/tools/native-diff-ext/bridge.js +0 -26
  164. package/e2e/tools/native-diff-ext/content.js +0 -194
  165. package/e2e/tools/svg-preview.html +0 -56
  166. package/embed.html +0 -193
  167. package/eslint.config.mjs +0 -35
  168. package/firebase-debug.log +0 -108
  169. package/iframe-container-demo/diagram.html +0 -124
  170. package/iframe-container-demo/host.html +0 -817
  171. package/index.html +0 -771
  172. package/mermaid-zenuml-async-spa-auth.png +0 -0
  173. package/mermaid-zenuml-async-spa-auth.snapshot.md +0 -96
  174. package/newsletter/unicode-support-announcement.md +0 -134
  175. package/playground/creation.html +0 -53
  176. package/playground/message.html +0 -63
  177. package/playwright.config.ts +0 -40
  178. package/renderer.html +0 -366
  179. package/scripts/analyze-compare-case/collect-data.mjs +0 -1134
  180. package/scripts/analyze-compare-case/config.mjs +0 -102
  181. package/scripts/analyze-compare-case/geometry.mjs +0 -101
  182. package/scripts/analyze-compare-case/native-diff.mjs +0 -224
  183. package/scripts/analyze-compare-case/output.mjs +0 -74
  184. package/scripts/analyze-compare-case/panel-diff.mjs +0 -114
  185. package/scripts/analyze-compare-case/report.mjs +0 -162
  186. package/scripts/analyze-compare-case/residual-scopes.mjs +0 -347
  187. package/scripts/analyze-compare-case/scoring.mjs +0 -829
  188. package/scripts/analyze-compare-case.mjs +0 -149
  189. package/scripts/bump-version.js +0 -117
  190. package/scripts/snapshot-dual.js +0 -173
  191. package/scripts/update-snapshots.js +0 -70
  192. package/skills/dia-scoring/SKILL.md +0 -129
  193. package/skills/dia-scoring/agents/openai.yaml +0 -7
  194. package/skills/dia-scoring/references/selectors-and-keys.md +0 -253
  195. package/tailwind.config.js +0 -126
  196. package/test-compression.html +0 -274
  197. package/test-mermaid-zenuml.html +0 -57
  198. package/test-setup.ts +0 -124
  199. package/test-url-params.html +0 -192
  200. package/tsconfig.app.json +0 -31
  201. package/tsconfig.node.json +0 -24
  202. package/tsconfig.test.json +0 -9
  203. package/vite.config.lib.ts +0 -93
  204. package/vite.config.ts +0 -84
  205. package/wrangler.toml +0 -18
@@ -1,57 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
- <title>Mermaid Zenuml Test Page</title>
7
- </head>
8
-
9
- <body>
10
- <h1>Zenuml demos</h1>
11
- <pre class="mermaid">
12
- zenuml
13
- BookLibService.Borrow(id) {
14
- User = Session.GetUser()
15
- if(User.isActive) {
16
- try {
17
- BookRepository.Update(id, onLoan, User)
18
- receipt = new Receipt(id, dueDate)
19
- } catch (BookNotFoundException) {
20
- ErrorService.onException(BookNotFoundException)
21
- } finally {
22
- Connection.close()
23
- }
24
- }
25
- return receipt
26
- }
27
- </pre>
28
- <pre class="mermaid">
29
- zenuml
30
- title Async Messages (SPA Authentication)
31
- // ```
32
- // GET https://${account.namespace}/authorize/?
33
- // response_type=token
34
- // &client_id=${account.clientId}
35
- // &redirect_url=YOUR_CALLBACK_URL
36
- // &state=VALUE_THAT_SURVIVES_REDIRECTS
37
- // &scope=openid
38
- // ```
39
- Browser->Auth0: 1. initiate the authentication
40
- Auth0->"Identity Provider": 2. OAuth2 / SAML, etc
41
- "Identity Provider"->"Identity Provider": 3. user gets authenticated
42
- Auth0->Browser: 4. redirect to ${YOUR_CALLBACK_URL}/#id_token=e68...
43
- Browser->Auth0: 5. validate id_token and get user profile
44
- Browser->"Your API": 6. call API sending JWT in Authorization header
45
- "Your API"->"Your API": 7. validate token
46
- </pre>
47
-
48
- <script type="module">
49
- import mermaid from 'https://unpkg.com/mermaid/dist/mermaid.esm.mjs';
50
- import zenuml from 'https://unpkg.com/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.mjs';
51
- await mermaid.registerExternalDiagrams([zenuml]);
52
- mermaid.initialize({
53
- logLevel: 3,
54
- });
55
- </script>
56
- </body>
57
- </html>
package/test-setup.ts DELETED
@@ -1,124 +0,0 @@
1
- /**
2
- * Test setup file for Bun test runner
3
- * This file is preloaded before all tests to set up the test environment
4
- */
5
-
6
- // Set up DOM environment using happy-dom (faster than jsdom)
7
- import { GlobalRegistrator } from "@happy-dom/global-registrator";
8
-
9
- // Register happy-dom globals (document, window, navigator, etc.)
10
- GlobalRegistrator.register();
11
-
12
- // Add missing globals that happy-dom doesn't provide but tests expect
13
- if (!global.origin) {
14
- global.origin = "http://localhost";
15
- }
16
-
17
- // Import Bun's test globals to make them available everywhere
18
- import { describe, test, it, expect, beforeEach, afterEach, beforeAll, afterAll, jest, mock } from "bun:test";
19
-
20
- // Make test globals available
21
- global.describe = describe;
22
- global.test = test;
23
- global.it = it;
24
- global.expect = expect;
25
- global.beforeEach = beforeEach;
26
- global.afterEach = afterEach;
27
- global.beforeAll = beforeAll;
28
- global.afterAll = afterAll;
29
- global.jest = jest;
30
-
31
- // Add Vitest-compatible mocking utilities for Bun
32
- // Map 'vi' to Bun's jest-compatible APIs
33
- const stubbedGlobals = new Map();
34
-
35
- global.vi = {
36
- fn: (impl?: any) => jest.fn(impl),
37
- spyOn: jest.spyOn,
38
- clearAllMocks: jest.clearAllMocks,
39
- resetAllMocks: jest.resetAllMocks,
40
- restoreAllMocks: jest.restoreAllMocks,
41
- stubGlobal: (name: string, value: any) => {
42
- // Store original value if not already stored
43
- if (!stubbedGlobals.has(name)) {
44
- stubbedGlobals.set(name, (global as any)[name]);
45
- }
46
- (global as any)[name] = value;
47
- return vi;
48
- },
49
- unstubAllGlobals: () => {
50
- // Restore all stubbed globals
51
- stubbedGlobals.forEach((originalValue, name) => {
52
- if (originalValue === undefined) {
53
- delete (global as any)[name];
54
- } else {
55
- (global as any)[name] = originalValue;
56
- }
57
- });
58
- stubbedGlobals.clear();
59
- return vi;
60
- },
61
- mocked: (fn: any) => fn as jest.Mock,
62
- };
63
-
64
- // Set up global test utilities if needed
65
- import "@testing-library/jest-dom";
66
-
67
- // Configure Testing Library
68
- import { configure } from "@testing-library/react";
69
-
70
- configure({
71
- // Reduce timeout for faster test failures
72
- asyncUtilTimeout: 2000,
73
- // Show better error messages
74
- getElementError: (message, container) => {
75
- const error = new Error(message || "");
76
- error.name = "TestingLibraryElementError";
77
- return error;
78
- },
79
- });
80
-
81
- // Mock IntersectionObserver if needed (not available in happy-dom by default)
82
- global.IntersectionObserver = class IntersectionObserver {
83
- constructor() {}
84
- disconnect() {}
85
- observe() {}
86
- unobserve() {}
87
- takeRecords() {
88
- return [];
89
- }
90
- };
91
-
92
- // Mock ResizeObserver if needed
93
- global.ResizeObserver = class ResizeObserver {
94
- constructor() {}
95
- disconnect() {}
96
- observe() {}
97
- unobserve() {}
98
- };
99
-
100
- // Inject @napi-rs/canvas for accurate text measurement in all tests.
101
- // happy-dom's canvas doesn't do real text measurement, which causes
102
- // WidthProviderOnCanvas to return inaccurate widths.
103
- import { createCanvas } from "@napi-rs/canvas";
104
- import { setCanvasContext } from "./src/positioning/WidthProviderFunc";
105
- const _napiCanvas = createCanvas(1, 1);
106
- setCanvasContext(_napiCanvas.getContext("2d") as unknown as CanvasRenderingContext2D);
107
-
108
- // Add custom matchers or global test utilities here
109
- // For example:
110
- // expect.extend({
111
- // toBeWithinRange(received, floor, ceiling) {
112
- // const pass = received >= floor && received <= ceiling;
113
- // return { pass };
114
- // },
115
- // });
116
-
117
- // Clean up after all tests
118
- if (typeof afterAll !== "undefined") {
119
- afterAll(() => {
120
- if (GlobalRegistrator.isRegistered) {
121
- GlobalRegistrator.unregister();
122
- }
123
- });
124
- }
@@ -1,192 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>URL Parameter Test</title>
7
- </head>
8
- <body>
9
- <h1>URL Parameter Extraction Test</h1>
10
- <div id="test-results"></div>
11
-
12
- <script>
13
- // Utility function to escape HTML special characters
14
- function escapeHTML(str) {
15
- return str.replace(/[&<>"']/g, (char) => {
16
- const escapeMap = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' };
17
- return escapeMap[char];
18
- });
19
- }
20
-
21
- // Copy the URL parameter extraction functions from renderer.html
22
- function extractCodeFromURL() {
23
- try {
24
- console.log('Extracting code parameter from URL...');
25
-
26
- // Get current URL
27
- const currentUrl = new URL(window.location.href);
28
- console.log('Current URL:', currentUrl.href);
29
-
30
- // Extract the 'code' parameter
31
- const codeParam = currentUrl.searchParams.get('code');
32
-
33
- if (codeParam) {
34
- console.log('Code parameter found:', codeParam.substring(0, 50) + '...');
35
- return codeParam;
36
- } else {
37
- console.log('No code parameter found in URL');
38
- return null;
39
- }
40
- } catch (error) {
41
- console.error('Error extracting code from URL:', error);
42
- return null;
43
- }
44
- }
45
-
46
- function hasCodeParameter() {
47
- try {
48
- const currentUrl = new URL(window.location.href);
49
- return currentUrl.searchParams.has('code');
50
- } catch (error) {
51
- console.error('Error checking for code parameter:', error);
52
- return false;
53
- }
54
- }
55
-
56
- // Base64 decoding functions (copied from renderer.html)
57
- function decodeBase64(encodedString) {
58
- try {
59
- console.log('Attempting to decode Base64 string...');
60
-
61
- // Check if the string is valid Base64
62
- if (!encodedString || typeof encodedString !== 'string') {
63
- throw new Error('Invalid input: string is null, undefined, or not a string');
64
- }
65
-
66
- // Remove any whitespace
67
- const cleanedString = encodedString.trim();
68
-
69
- // Check if string looks like Base64 (basic validation)
70
- const base64Regex = /^[A-Za-z0-9+/]*={0,2}$/;
71
- if (!base64Regex.test(cleanedString)) {
72
- throw new Error('Invalid Base64 format');
73
- }
74
-
75
- // Attempt to decode
76
- const decodedString = atob(cleanedString);
77
- console.log('Base64 decoding successful');
78
-
79
- return decodedString;
80
- } catch (error) {
81
- console.error('Base64 decoding failed:', error);
82
- throw new Error(`Base64 decoding failed: ${error.message}`);
83
- }
84
- }
85
-
86
- function processURLCodeParameter(encodedCode) {
87
- try {
88
- console.log('Processing URL code parameter...');
89
-
90
- if (!encodedCode) {
91
- console.log('No encoded code provided');
92
- return null;
93
- }
94
-
95
- // Try to decode as Base64
96
- const decodedCode = decodeBase64(encodedCode);
97
- console.log('Code parameter successfully decoded from Base64');
98
-
99
- return decodedCode;
100
- } catch (error) {
101
- console.error('Failed to process URL code parameter:', error);
102
-
103
- // Return the original code as fallback (might be plain text)
104
- console.log('Falling back to using raw parameter value');
105
- return encodedCode;
106
- }
107
- }
108
-
109
- // Test the functions
110
- function runTests() {
111
- const resultsDiv = document.getElementById('test-results');
112
- let results = '<h2>Test Results:</h2>';
113
-
114
- // Test 1: Check current URL
115
- const currentUrl = window.location.href;
116
- results += `<p><strong>Current URL:</strong> ${escapeHTML(currentUrl)}</p>`;
117
-
118
- // Test 2: Check if code parameter exists
119
- const hasCode = hasCodeParameter();
120
- results += `<p><strong>Has code parameter:</strong> ${hasCode}</p>`;
121
-
122
- // Test 3: Extract code parameter
123
- const codeParam = extractCodeFromURL();
124
- results += `<p><strong>Extracted code parameter:</strong> ${escapeHTML(codeParam) || 'null'}</p>`;
125
-
126
- // Test 4: Process URL code parameter (includes Base64 decoding)
127
- if (codeParam) {
128
- try {
129
- const processedCode = processURLCodeParameter(codeParam);
130
- results += `<p><strong>Processed code (after Base64 decoding):</strong></p>`;
131
- results += `<pre style="background: #f5f5f5; padding: 10px; border-radius: 4px; white-space: pre-wrap;">${processedCode || 'null'}</pre>`;
132
-
133
- // Check if it was actually Base64 decoded
134
- if (processedCode !== codeParam) {
135
- results += `<p style="color: green;"><strong>✓ Base64 decoding successful!</strong></p>`;
136
- } else {
137
- results += `<p style="color: orange;"><strong>⚠ Used raw parameter (not Base64 or decoding failed)</strong></p>`;
138
- }
139
- } catch (error) {
140
- results += `<p style="color: red;"><strong>✗ Error processing code parameter:</strong> ${error.message}</p>`;
141
- }
142
- }
143
-
144
- // Test 5: Show all URL parameters
145
- const urlParams = new URLSearchParams(window.location.search);
146
- results += '<p><strong>All URL parameters:</strong></p><ul>';
147
- for (const [key, value] of urlParams) {
148
- results += `<li>${escapeHTML(key)}: ${escapeHTML(value)}</li>`;
149
- }
150
- results += '</ul>';
151
-
152
- resultsDiv.innerHTML = results;
153
- }
154
-
155
- // Run tests when page loads
156
- window.addEventListener('load', runTests);
157
- </script>
158
-
159
- <h2>Test Instructions:</h2>
160
- <p>To test URL parameter extraction and Base64 decoding, add parameters to the URL:</p>
161
- <ul>
162
- <li><a href="?code=test123">Test with simple code parameter</a></li>
163
- <li><a href="?code=dGVzdCBjb2Rl">Test with Base64 code parameter ("test code")</a></li>
164
- <li><a href="?code=SGVsbG8gV29ybGQ=">Test with Base64 code parameter ("Hello World")</a></li>
165
- <li><a href="?code=QS5tZXRob2QoKSB7IEIucHJvY2VzcygpIH0=">Test with Base64 ZenUML code</a></li>
166
- <li><a href="?code=test123&theme=dark">Test with multiple parameters</a></li>
167
- <li><a href="?code=invalid@base64!">Test with invalid Base64 (should fallback)</a></li>
168
- <li><a href="?other=value">Test with no code parameter</a></li>
169
- </ul>
170
-
171
- <h3>Base64 Encoding Helper:</h3>
172
- <p>Enter text to encode as Base64:</p>
173
- <input type="text" id="textInput" placeholder="Enter text to encode" style="width: 300px; padding: 5px;">
174
- <button onclick="encodeText()" style="padding: 5px 10px;">Encode to Base64</button>
175
- <p>Base64 result: <span id="base64Result" style="font-family: monospace; background: #f0f0f0; padding: 2px 4px;"></span></p>
176
-
177
- <script>
178
- function encodeText() {
179
- const text = document.getElementById('textInput').value;
180
- if (text) {
181
- const encoded = btoa(text);
182
- document.getElementById('base64Result').textContent = encoded;
183
-
184
- // Create a test link
185
- const testUrl = `?code=${encoded}`;
186
- document.getElementById('base64Result').innerHTML =
187
- `${encoded} <br><a href="${testUrl}" style="font-size: 12px;">Test this Base64 code</a>`;
188
- }
189
- }
190
- </script>
191
- </body>
192
- </html>
package/tsconfig.app.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
4
- "target": "ES2020",
5
- "useDefineForClassFields": true,
6
- "lib": ["ES2020", "DOM", "DOM.Iterable"],
7
- "module": "ESNext",
8
- "skipLibCheck": true,
9
- "paths": {
10
- "@/*": ["./src/*"]
11
- },
12
- "allowJs": true,
13
- "types": ["vitest/globals", "@testing-library/jest-dom"],
14
-
15
- /* Bundler mode */
16
- "moduleResolution": "bundler",
17
- "allowImportingTsExtensions": true,
18
- "isolatedModules": true,
19
- "moduleDetection": "force",
20
- "noEmit": true,
21
- "jsx": "react-jsx",
22
-
23
- /* Linting */
24
- "strict": true,
25
- "noUnusedLocals": true,
26
- "noUnusedParameters": true,
27
- "noFallthroughCasesInSwitch": true,
28
- "noUncheckedSideEffectImports": true
29
- },
30
- "include": ["src"]
31
- }
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
4
- "target": "ES2022",
5
- "lib": ["ES2023"],
6
- "module": "ESNext",
7
- "skipLibCheck": true,
8
-
9
- /* Bundler mode */
10
- "moduleResolution": "bundler",
11
- "allowImportingTsExtensions": true,
12
- "isolatedModules": true,
13
- "moduleDetection": "force",
14
- "noEmit": true,
15
-
16
- /* Linting */
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "noUncheckedSideEffectImports": true
22
- },
23
- "include": ["vite.config.ts"]
24
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.app.json",
3
- "compilerOptions": {
4
- "jsx": "react-jsx",
5
- "types": ["node", "jsdom", "vitest/globals", "@testing-library/jest-dom"]
6
- },
7
- "include": ["test/**/*.ts", "test/**/*.tsx", "src/**/*.ts", "src/**/*.tsx"],
8
- "exclude": ["node_modules"]
9
- }
@@ -1,93 +0,0 @@
1
- /* eslint-env node */
2
- import { resolve } from "path";
3
- import { defineConfig } from "vite";
4
- import react from "@vitejs/plugin-react";
5
- import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6
- import svgr from "vite-plugin-svgr";
7
- import { visualizer } from "rollup-plugin-visualizer";
8
- import { execSync } from "child_process";
9
- import { readFileSync } from "fs";
10
-
11
- // Read version from package.json
12
- const packageJson = JSON.parse(
13
- readFileSync(resolve(__dirname, "package.json"), "utf-8"),
14
- );
15
-
16
- const gitHash = process.env.DOCKER
17
- ? ""
18
- : execSync("git rev-parse --short HEAD").toString().trim();
19
- const gitBranch = process.env.DOCKER
20
- ? ""
21
- : execSync("git branch --show-current").toString().trim();
22
-
23
- const isReleaseBuild = process.env.RELEASE === "1";
24
- const shouldAnalyzeBundle = process.env.ANALYZE === "1";
25
-
26
- // Merge all cloud-provider icon SVGs into a single chunk instead of 500+
27
- function manualChunks(id: string) {
28
- if (
29
- id.includes("AWS-Asset-Package") ||
30
- id.includes("Architecture-Service-Icons") ||
31
- id.includes("google-cloud-icons") ||
32
- id.includes("Azure_Public_Service_Icons") ||
33
- id.includes("HLD-Architecture") ||
34
- id.includes("CloudIcons")
35
- ) {
36
- return "cloud-icons";
37
- }
38
- }
39
-
40
- export default defineConfig({
41
- build: {
42
- target: "esnext",
43
- // https://vitejs.dev/guide/build.html#library-mode
44
- lib: {
45
- entry: resolve(__dirname, "src/core.tsx"),
46
- // https://vitejs.dev/config/build-options.html#build-lib
47
- // the exposed global variable and is required when formats includes 'umd' or 'iife'.
48
- name: "ZenUML",
49
- fileName: "zenuml",
50
- },
51
- sourcemap: isReleaseBuild,
52
- rollupOptions: {
53
- output: [
54
- {
55
- format: "esm",
56
- entryFileNames: `zenuml.esm.mjs`,
57
- manualChunks,
58
- },
59
- {
60
- name: "zenuml",
61
- format: "umd",
62
- entryFileNames: `zenuml.js`,
63
- },
64
- ],
65
- },
66
- },
67
- resolve: {
68
- alias: {
69
- "@": resolve(__dirname, "./src"),
70
- },
71
- },
72
- plugins: [
73
- svgr(),
74
- react(),
75
- cssInjectedByJsPlugin(),
76
- ...(shouldAnalyzeBundle
77
- ? [
78
- visualizer({
79
- filename: "dist/stats.html",
80
- open: false,
81
- gzipSize: true,
82
- brotliSize: true,
83
- }),
84
- ]
85
- : []),
86
- ],
87
- define: {
88
- "process.env.NODE_ENV": '"production"',
89
- "process.env.VITE_VERSION": JSON.stringify(packageJson.version),
90
- "import.meta.env.VITE_APP_GIT_HASH": JSON.stringify(gitHash),
91
- "import.meta.env.VITE_APP_GIT_BRANCH": JSON.stringify(gitBranch),
92
- },
93
- });
package/vite.config.ts DELETED
@@ -1,84 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import react from "@vitejs/plugin-react";
3
- import { resolve } from "path";
4
- import { execSync } from "child_process";
5
- import { readFileSync } from "fs";
6
- import svgr from "vite-plugin-svgr";
7
-
8
- const gitHash = process.env.DOCKER
9
- ? ""
10
- : execSync("git rev-parse --short HEAD").toString().trim();
11
- const gitBranch = process.env.DOCKER
12
- ? ""
13
- : execSync("git branch --show-current").toString().trim();
14
-
15
- const packageJson = JSON.parse(
16
- readFileSync(resolve(__dirname, "package.json"), "utf-8"),
17
- );
18
-
19
- // e2e fixtures and test-compression.html are served via the Vite dev server
20
- // (Playwright launches `bun run dev` — see playwright.config.ts), so they
21
- // don't need to be part of the production site build. Set INCLUDE_E2E_HTML=1
22
- // to bundle them into a built site (rare; only needed if hosting the
23
- // fixtures statically instead of running them via dev server).
24
- function getE2eHtmlFiles() {
25
- const e2eFolder = resolve(__dirname, "e2e");
26
- const strings = execSync(`find ${e2eFolder} -name '*.html'`)
27
- .toString()
28
- .split("\n");
29
- // remove empty string
30
- strings.pop();
31
- return strings;
32
- }
33
-
34
- const includeE2eHtml = process.env.INCLUDE_E2E_HTML === "1";
35
- const e2eHtmlFiles = includeE2eHtml ? getE2eHtmlFiles() : [];
36
- const optionalDevHtml = includeE2eHtml ? ["test-compression.html"] : [];
37
-
38
- export default defineConfig(({ mode }) => ({
39
- base: mode === "gh-pages" ? "/zenuml-core/" : "/",
40
- build: {
41
- target: "esnext",
42
- rollupOptions: {
43
- input: ["index.html", "embed.html", "renderer.html", ...optionalDevHtml, ...e2eHtmlFiles],
44
- },
45
- },
46
- resolve: {
47
- alias: {
48
- "@": resolve(__dirname, "./src"),
49
- },
50
- },
51
- server: {
52
- allowedHosts: ["8080.diagramly.net"],
53
- },
54
- plugins: [svgr(), react()],
55
- define: {
56
- "process.env.NODE_ENV": JSON.stringify(mode),
57
- "process.env.VITE_BUILD_TIME": JSON.stringify(new Date().toISOString()),
58
- "process.env.VITE_VERSION": JSON.stringify(packageJson.version),
59
- "import.meta.env.VITE_APP_GIT_HASH": JSON.stringify(gitHash),
60
- "import.meta.env.VITE_APP_GIT_BRANCH": JSON.stringify(gitBranch),
61
- },
62
- css: {
63
- preprocessorOptions: {
64
- scss: {
65
- api: "modern-compiler",
66
- },
67
- },
68
- },
69
- test: {
70
- // used by vitest: https://vitest.dev/guide/#configuring-vitest
71
- // need this to run vitest in webstorm ide. vitest has better integration than bun
72
- environment: "jsdom",
73
- reportOnFailure: true,
74
- globals: true,
75
- coverage: {
76
- provider: "v8", // or 'v8'
77
- },
78
- setupFiles: resolve(__dirname, "test/setup.ts"),
79
- exclude: [
80
- "node_modules/**",
81
- "tests/**", // Exclude Playwright tests
82
- ],
83
- },
84
- }));
package/wrangler.toml DELETED
@@ -1,18 +0,0 @@
1
- name = "zenuml-web-renderer"
2
- compatibility_date = "2024-01-01"
3
-
4
- # Use Workers Static Assets (recommended over Pages)
5
- [assets]
6
- directory = "dist"
7
-
8
- [env.production]
9
- name = "zenuml-web-renderer"
10
-
11
- [env.production.assets]
12
- directory = "dist"
13
-
14
- [env.staging]
15
- name = "zenuml-web-renderer-staging"
16
-
17
- [env.staging.assets]
18
- directory = "dist"