Skip to content

Commit

Permalink
Use default theme in main.ts.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCoder committed Nov 11, 2023
1 parent c03e774 commit 925a2d0
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 28 deletions.
6 changes: 3 additions & 3 deletions cy/defect-406-alt-under-creation.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,7 +13,7 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">
title Title 1
A.m1 {
new B(1,2,3,4) {
Expand All @@ -35,6 +35,6 @@
>
</div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions cy/smoke-creation.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,14 +13,14 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">
title Title 1
A.m {
new B(1,2,3,4)
}</pre
>
</div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions cy/smoke-fragment-issue.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,7 +13,7 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">
// This sample is carefully crafted. It shows a known issues: fragment stretched to
// svc (should not), because parser thinks the return statement returns to svc.
group G {@VPC svc @RDS rep} Client
Expand All @@ -30,6 +30,6 @@
>
</div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions cy/smoke-fragment.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,7 +13,7 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">
A
B
C #FF0000 // we style it to make it more important in image comparison
Expand All @@ -38,6 +38,6 @@
</div>

<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions cy/smoke-interaction.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,7 +13,7 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">
if(x) {
A.method() {
B.method() {
Expand All @@ -29,6 +29,6 @@
</div>

<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions cy/smoke-return.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,7 +13,7 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">
Browser->BookController.onPost() {
BookLibService.Borrow(id) {
receipt = process(id1)
Expand All @@ -33,6 +33,6 @@
>
</div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions cy/smoke.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand All @@ -13,7 +13,7 @@
</head>
<body>
<div id="diagram" class="diagram">
<pre class="zenuml" style="margin: 0;">
<pre class="zenuml" style="margin: 0">

title ABCD Title
// Generating Sequence Diagrams from Java code is experimental.
Expand All @@ -37,6 +37,6 @@
>
</div>
<!-- built files will be auto injected -->
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/src/main-cy.ts"></script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions src/main-cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import parentLogger from "./logger/logger";
import ZenUml from "./core";
const logger = parentLogger.child({ name: "main" });

// find the fist element with tag `pre` and class `zenuml`
const elm = document.querySelector("pre.zenuml");
// get the code from the element
const code =
elm?.textContent?.trim() ||
`
// comment
A
A.method`;
// @ts-ignore
const zenUml = new ZenUml(elm);
console.log("set zenUML to window");

// @ts-ignore
window.zenUml = zenUml;
zenUml.render(code, { theme: "theme-nab" }).then((r) => {
logger.debug("render resolved", r);
});
// @ts-ignore
window.parentLogger = parentLogger;
14 changes: 7 additions & 7 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import parentLogger from './logger/logger';
import ZenUml from './core';
const logger = parentLogger.child({ name: 'main' });
import parentLogger from "./logger/logger";
import ZenUml from "./core";
const logger = parentLogger.child({ name: "main" });

// find the fist element with tag `pre` and class `zenuml`
const elm = document.querySelector('pre.zenuml');
const elm = document.querySelector("pre.zenuml");
// get the code from the element
const code =
elm?.textContent?.trim() ||
Expand All @@ -13,12 +13,12 @@ A
A.method`;
// @ts-ignore
const zenUml = new ZenUml(elm);
console.log('set zenUML to window');
console.log("set zenUML to window");

// @ts-ignore
window.zenUml = zenUml;
zenUml.render(code, {theme: 'theme-nab'}).then((r) => {
logger.debug('render resolved', r);
zenUml.render(code, { theme: "theme-default" }).then((r) => {
logger.debug("render resolved", r);
});
// @ts-ignore
window.parentLogger = parentLogger;

0 comments on commit 925a2d0

Please sign in to comment.