Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default theme in main.ts. #83

Merged
merged 1 commit into from
Nov 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;