@zenuml/core 2.0.20 → 2.0.21
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.
- package/Integration/vanilla-js/index.html +17 -17
- package/README.md +18 -13
- package/README_CN.md +5 -5
- package/cy/defect-406-alt-under-creation.html +5 -4
- package/cy/smoke-creation.html +5 -4
- package/cy/smoke-fragment-issue.html +4 -6
- package/cy/smoke-fragment.html +5 -6
- package/cy/smoke-interaction.html +5 -5
- package/cy/smoke-return.html +4 -4
- package/cy/smoke.html +4 -5
- package/cypress.config.ts +3 -3
- package/dist/embed-container-demo.html +40 -25
- package/dist/style.css +1 -1
- package/dist/zenuml-core.mjs +2407 -2348
- package/dist/zenuml-core.umd.js +47 -47
- package/docs/async-vs-sync-parser-rules.md +5 -2
- package/docs/divider-parser-allow-spaces.md +2 -2
- package/docs/highlighting-messages.md +10 -5
- package/docs/inherited-vs-provided-from.md +9 -4
- package/docs/participants-function.md +2 -4
- package/docs/responsive-participant-margin.md +2 -2
- package/docs/starter.md +2 -1
- package/docs/testing-minified-lib.md +7 -9
- package/docs/why-we-publish-embed-view-to-github-pages.md +2 -1
- package/docs/width-translate-and-offsets.md +14 -6
- package/embed.html +56 -56
- package/index.html +53 -27
- package/package.json +3 -4
- package/playground/creation.html +50 -29
- package/playground/message.html +60 -36
- package/tailwind.config.js +31 -18
- package/types/index.d.ts +7 -7
- package/vite.config.js +20 -25
- package/vite.config.lib.js +17 -20
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
Async:
|
|
2
|
+
|
|
2
3
|
```
|
|
3
4
|
asyncMessage
|
|
4
5
|
: source ARROW target COL content
|
|
@@ -17,7 +18,9 @@ target
|
|
|
17
18
|
: ID | STRING
|
|
18
19
|
;
|
|
19
20
|
```
|
|
21
|
+
|
|
20
22
|
Sync:
|
|
23
|
+
|
|
21
24
|
```
|
|
22
25
|
message
|
|
23
26
|
: messageBody (SCOL | braceBlock)?
|
|
@@ -52,8 +55,8 @@ assignment
|
|
|
52
55
|
: (type? assignee ASSIGN)
|
|
53
56
|
;
|
|
54
57
|
```
|
|
55
|
-
First of all, `from->to` and `source->target` are very similar. Let's first merge them.
|
|
56
58
|
|
|
59
|
+
First of all, `from->to` and `source->target` are very similar. Let's first merge them.
|
|
57
60
|
|
|
58
61
|
if(!this.rightToLeft) {
|
|
59
62
|
if(this.outOfBand) {
|
|
@@ -75,4 +78,4 @@ First of all, `from->to` and `source->target` are very similar. Let's first merg
|
|
|
75
78
|
// to origin
|
|
76
79
|
const dist = this.distance2(this.to, this.origin)
|
|
77
80
|
return (dist - indent - fragmentOff) * (-1)
|
|
78
|
-
}
|
|
81
|
+
}
|
|
@@ -6,6 +6,7 @@ The `divider` statement is used to separate the sequence of statements into logi
|
|
|
6
6
|
groups.
|
|
7
7
|
|
|
8
8
|
For example, a HTTPS sequence can be separated into three logical groups:
|
|
9
|
+
|
|
9
10
|
1. Connect establishment
|
|
10
11
|
2. TLS handshake
|
|
11
12
|
3. HTTP request/response
|
|
@@ -32,7 +33,6 @@ Server->Client: HTTP Response
|
|
|
32
33
|
|
|
33
34
|
## The Lexer
|
|
34
35
|
|
|
35
|
-
|
|
36
36
|
## `divider` is a statement
|
|
37
37
|
|
|
38
|
-
`divider` is treated as a statement as any other messages.
|
|
38
|
+
`divider` is treated as a statement as any other messages.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Since 1.0.63
|
|
2
2
|
|
|
3
3
|
# Highlighting messages
|
|
4
|
+
|
|
4
5
|
The renderer will highlight an `Interaction` based on the value of `cursor` in the store.
|
|
5
6
|
For example, for DSL `A.x B.y`, if `cursor` is between [0, 3], `A.x` is highlighted in
|
|
6
|
-
the diagram; if `cursor` is between [4, 7], `B.y` is highlighted.
|
|
7
|
+
the diagram; if `cursor` is between [4, 7], `B.y` is highlighted.
|
|
7
8
|
|
|
8
9
|
## What elements can be highlighted?
|
|
9
10
|
|
|
10
|
-
Theoretically, every element can be highlighted. The logic is different for
|
|
11
|
+
Theoretically, every element can be highlighted. The logic is different for
|
|
11
12
|
different types.
|
|
12
13
|
|
|
13
14
|
We will focus on messages: Creation and Messages (Sync & Async).
|
|
@@ -15,32 +16,36 @@ We will focus on messages: Creation and Messages (Sync & Async).
|
|
|
15
16
|
### Creation
|
|
16
17
|
|
|
17
18
|
Creations parser definition is:
|
|
19
|
+
|
|
18
20
|
```
|
|
19
21
|
creationBody (SCOL | braceBlock)?
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
We will highlight the creation call and assignment but NOT the `braceBlock`.
|
|
24
|
+
We will highlight the creation call and assignment but NOT the `braceBlock`.
|
|
23
25
|
The triggering cursor must be in between `creationBody`.
|
|
24
26
|
|
|
25
27
|
### Message
|
|
26
28
|
|
|
27
29
|
Message parser definition is:
|
|
30
|
+
|
|
28
31
|
```
|
|
29
32
|
messageBody (SCOL | braceBlock)?
|
|
30
33
|
```
|
|
34
|
+
|
|
31
35
|
We will highlight the message call and assignment but NOT the `braceBlock`.
|
|
32
36
|
The triggering cursor must be in between `messageBody`.
|
|
33
37
|
|
|
34
38
|
### Async Message
|
|
35
39
|
|
|
36
40
|
Async message parser definition is:
|
|
41
|
+
|
|
37
42
|
```
|
|
38
43
|
source ARROW target COL content
|
|
39
|
-
```
|
|
44
|
+
```
|
|
45
|
+
|
|
40
46
|
We will highlight the whole message call.
|
|
41
47
|
The triggering curso must bee in between `source ARROW target COL content`.
|
|
42
48
|
|
|
43
|
-
|
|
44
49
|
## Implementation
|
|
45
50
|
|
|
46
51
|
The global store has a state `cursor`. Each component check whether this cursor
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
What we should be looking at is `statement` which can be one of:
|
|
2
|
+
|
|
2
3
|
1. Alt/Par/Opt/Loop
|
|
3
4
|
1. Message
|
|
4
5
|
1. Creation
|
|
@@ -9,20 +10,22 @@ we need to find its parent message or creation and get their owners.
|
|
|
9
10
|
|
|
10
11
|
There are two ways to decide where the message is from.
|
|
11
12
|
One way is to deduce from its parent context - inherited from;
|
|
12
|
-
the other way is to explicitly define it from its own context -
|
|
13
|
+
the other way is to explicitly define it from its own context -
|
|
13
14
|
provided from.
|
|
14
15
|
|
|
15
16
|
## Inherited
|
|
16
17
|
|
|
17
18
|
Sync message
|
|
19
|
+
|
|
18
20
|
```
|
|
19
21
|
A.m1 {
|
|
20
22
|
// m2 has an "inherited from" as `A`
|
|
21
|
-
m2
|
|
23
|
+
m2
|
|
22
24
|
}
|
|
23
25
|
```
|
|
24
26
|
|
|
25
27
|
Async message
|
|
28
|
+
|
|
26
29
|
```
|
|
27
30
|
A.m1 {
|
|
28
31
|
// m2 has an "inherited from" as `A`
|
|
@@ -33,15 +36,17 @@ A.m1 {
|
|
|
33
36
|
## Provided
|
|
34
37
|
|
|
35
38
|
Sync message
|
|
39
|
+
|
|
36
40
|
```
|
|
37
41
|
A.m1 {
|
|
38
42
|
// m2 has a "provided from" as `B`
|
|
39
43
|
B->C.m2
|
|
40
|
-
|
|
44
|
+
|
|
41
45
|
}
|
|
42
46
|
```
|
|
43
47
|
|
|
44
48
|
Async message
|
|
49
|
+
|
|
45
50
|
```
|
|
46
51
|
A.m1 {
|
|
47
52
|
// m2 has a "provided from" as `B`
|
|
@@ -49,7 +54,7 @@ A.m1 {
|
|
|
49
54
|
}
|
|
50
55
|
```
|
|
51
56
|
|
|
52
|
-
It is allowed to have a `provided from` that equals to its
|
|
57
|
+
It is allowed to have a `provided from` that equals to its
|
|
53
58
|
`inherited from`.
|
|
54
59
|
|
|
55
60
|
# Discussion
|
|
@@ -21,7 +21,5 @@ So `onParticipant` must overwrite that.
|
|
|
21
21
|
`getInheritedFrom` function. It will be convenient that it returns
|
|
22
22
|
`from` directly.
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
to calculate the translateX for Interactions.
|
|
27
|
-
|
|
24
|
+
However, we also need the `InheritedFrom` and `ProvidedFrom`
|
|
25
|
+
to calculate the translateX for Interactions.
|
|
@@ -2,7 +2,7 @@ This is to adjust the margin of the lifelines based on the message length.
|
|
|
2
2
|
For example, if the message is long, the margin of the lifelines will be increased.
|
|
3
3
|
|
|
4
4
|
A.method() {
|
|
5
|
-
|
|
5
|
+
B.aLongMethodName_and_we_want_to_adjust_the_margin_of_the_lifelines_based_on_the_message_length();
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
# Strategy A
|
|
@@ -16,7 +16,7 @@ Instead of rendering message layer based on lifeline's position, we render
|
|
|
16
16
|
the lifelines based on message occurrence's positions.
|
|
17
17
|
|
|
18
18
|
There is a problem of this strategy. If we pre-declare the order of the participants,
|
|
19
|
-
|
|
19
|
+
for example, `B A A.method()`, we have to render B on the left of A.
|
|
20
20
|
|
|
21
21
|
So maybe, we could implement it in two rounds. First, we define the order of participants.
|
|
22
22
|
Then we calculate the position of the lifelines based on the order.
|
package/docs/starter.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
There are two ways for the context to get declared Starter:
|
|
2
|
+
|
|
2
3
|
1. @Starter(X)
|
|
3
4
|
2. X->A:m or X->A.m
|
|
4
5
|
|
|
5
|
-
As long as the starter's name is not \
|
|
6
|
+
As long as the starter's name is not \_STARTER\_, it is treated as declared.
|
|
6
7
|
|
|
7
8
|
Then we check whether the Starter is a declared participant by its `explicit`
|
|
8
9
|
field.
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
```html
|
|
2
|
-
<meta charset="utf-8"
|
|
2
|
+
<meta charset="utf-8" />
|
|
3
3
|
<title>vue-sequence demo</title>
|
|
4
4
|
<script src="https://unpkg.com/vue@2.6.12/dist/vue.js"></script>
|
|
5
5
|
<script src="https://unpkg.com/vuex@3.6.2/dist/vuex.js"></script>
|
|
6
6
|
<script src="./vue-sequence.umd.min.js"></script>
|
|
7
7
|
|
|
8
|
-
<link rel="stylesheet" href="./vue-sequence.css"
|
|
8
|
+
<link rel="stylesheet" href="./vue-sequence.css" />
|
|
9
9
|
|
|
10
10
|
<div id="mounting-point"></div>
|
|
11
11
|
|
|
12
12
|
<script>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
console.log("window loaded");
|
|
13
|
+
window.addEventListener('load', function (event) {
|
|
14
|
+
console.log('window loaded');
|
|
16
15
|
Vue.use(Vuex);
|
|
17
16
|
let { SeqDiagram, Store } = window['vue-sequence'];
|
|
18
17
|
let storeConfig = Store();
|
|
19
|
-
storeConfig.state.code =
|
|
20
|
-
Vue.component(
|
|
18
|
+
storeConfig.state.code = 'A.method';
|
|
19
|
+
Vue.component('seq-diagram', SeqDiagram);
|
|
21
20
|
window.app = new Vue({
|
|
22
21
|
el: document.getElementById('mounting-point'),
|
|
23
22
|
store: new Vuex.Store(storeConfig),
|
|
24
|
-
render: (h) => h('seq-diagram')
|
|
23
|
+
render: (h) => h('seq-diagram'),
|
|
25
24
|
});
|
|
26
25
|
});
|
|
27
26
|
</script>
|
|
28
|
-
|
|
29
27
|
```
|
|
@@ -2,14 +2,15 @@ We have got two options to host the embed view: on GitHub pages or
|
|
|
2
2
|
Cloudflare pages (or other third party).
|
|
3
3
|
|
|
4
4
|
The benefit of Cloudflare pages is:
|
|
5
|
+
|
|
5
6
|
1. It offers multiple versions. Basically every publish will generate
|
|
6
7
|
a standalone url with current commit hash.
|
|
7
8
|
2. It does not require commit the `dist` folder to the repository.
|
|
8
9
|
|
|
9
10
|
The benefit of using GitHub Pages:
|
|
11
|
+
|
|
10
12
|
1. It will definitely be easier to set up for collaborators on GitHub,
|
|
11
13
|
because they do not need a Cloudflare account.
|
|
12
14
|
|
|
13
15
|
Easy collaboration is more important to us, so we will host this on
|
|
14
16
|
GitHub Pages.
|
|
15
|
-
|
|
@@ -4,11 +4,14 @@ Interaction width, in the most simple scenario, is defined by the distance of tw
|
|
|
4
4
|
`from` and `to`.
|
|
5
5
|
|
|
6
6
|
## Simple case
|
|
7
|
+
|
|
7
8
|
### Width
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
In the following
|
|
11
|
+
Each '◻' is a pixel
|
|
12
|
+
|
|
10
13
|
```
|
|
11
|
-
| A | | B |
|
|
14
|
+
| A | | B |
|
|
12
15
|
1 2 3 4 5 6 7 8 9 a b c d e f g h
|
|
13
16
|
◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻ ◻
|
|
14
17
|
```
|
|
@@ -20,10 +23,13 @@ A has left as 2, center as 4 and right as 6; B has a/c/e. For Interaction `m2` i
|
|
|
20
23
|
the width should be 4 to c (inclusive) that is 9 (`c - 4 + 1`). This is `distance(from, to)`.
|
|
21
24
|
|
|
22
25
|
#### 2. Message width
|
|
26
|
+
|
|
23
27
|
Message width should be 100% content + interactionBorderWidthx2 - ((OccurrenceWidth - 1)/2)x2 - interactionBorderWidth.
|
|
24
28
|
|
|
25
29
|
### Left
|
|
30
|
+
|
|
26
31
|
#### 1. Message left
|
|
32
|
+
|
|
27
33
|
```
|
|
28
34
|
100% // content width of interaction
|
|
29
35
|
+ InteractionBorderWidth x 2
|
|
@@ -31,24 +37,26 @@ Message width should be 100% content + interactionBorderWidthx2 - ((OccurrenceWi
|
|
|
31
37
|
```
|
|
32
38
|
|
|
33
39
|
#### 2. Self Occurrence Left
|
|
40
|
+
|
|
34
41
|
```
|
|
35
42
|
left: width of InteractionBorderWidth
|
|
36
43
|
```
|
|
44
|
+
|
|
37
45
|
### Offset
|
|
46
|
+
|
|
38
47
|
There are a few ways to implement offset, we have to combine them.
|
|
39
48
|
|
|
40
49
|
#### 1. Padding of occurance
|
|
50
|
+
|
|
41
51
|
> Suppose the width of an occurance is 5 (border width 1x2, content 3)
|
|
42
52
|
|
|
43
53
|
To aligh Occurance's center, we need to set its left. An occurance
|
|
44
54
|
at `left: 100%` will be from c to g. Note that the 100% only consider
|
|
45
55
|
the content width.
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
To align its center to c, we
|
|
48
58
|
have to move back by 3 (`(occuranceWidth-1)/2 - interactionBorderWidth - LifelineWidth`).
|
|
49
59
|
|
|
50
60
|
occurance must have a padding of 1 that is (width - boarder x 2 - 1) / 2.
|
|
51
61
|
|
|
52
62
|
## Self call indent
|
|
53
|
-
|
|
54
|
-
|
package/embed.html
CHANGED
|
@@ -1,43 +1,41 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html style="height: 100%; width: 100%">
|
|
3
3
|
<head>
|
|
4
|
-
<meta charset="utf-8"
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge"
|
|
6
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0"
|
|
7
|
-
<meta name="application-name" content="ZenUML"
|
|
8
|
-
<meta name="apple-mobile-web-app-title" content="ZenUML"
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
6
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
7
|
+
<meta name="application-name" content="ZenUML" />
|
|
8
|
+
<meta name="apple-mobile-web-app-title" content="ZenUML" />
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
10
10
|
<title>ZenUML</title>
|
|
11
|
-
<meta
|
|
12
|
-
|
|
11
|
+
<meta
|
|
12
|
+
name="Description"
|
|
13
|
+
content="ZenUML is a free online diagram application for generating sequence diagrams from text."
|
|
14
|
+
/>
|
|
15
|
+
<meta name="Keywords" content="diagram, online, sequence diagram, uml" />
|
|
13
16
|
</head>
|
|
14
17
|
<body style="height: 100%; width: 100%">
|
|
15
18
|
<noscript>
|
|
16
|
-
<strong
|
|
19
|
+
<strong
|
|
20
|
+
>We're sorry but ZenUML doesn't work properly without JavaScript enabled. Please enable it
|
|
21
|
+
to continue.</strong
|
|
22
|
+
>
|
|
17
23
|
</noscript>
|
|
18
24
|
<script>
|
|
19
25
|
(() => {
|
|
20
26
|
async function handle_message(ev) {
|
|
21
27
|
let { action, cmd_id } = ev.data;
|
|
22
|
-
const send_message = (payload) => parent.postMessage(
|
|
28
|
+
const send_message = (payload) => parent.postMessage({ ...payload }, ev.origin);
|
|
23
29
|
const send_reply = (payload) => send_message({ ...payload, cmd_id });
|
|
24
30
|
const send_ok = () => send_reply({ action: 'cmd_ok' });
|
|
25
|
-
const send_error = (message, stack) =>
|
|
31
|
+
const send_error = (message, stack) =>
|
|
32
|
+
send_reply({ action: 'cmd_error', message, stack });
|
|
26
33
|
|
|
27
34
|
if (action === 'eval') {
|
|
28
35
|
try {
|
|
29
|
-
let { code, theme, style, css } = ev.data.args
|
|
30
|
-
await zenUml.render(code, theme)
|
|
31
|
-
send_ok()
|
|
32
|
-
} catch (e) {
|
|
33
|
-
send_error(e.message, e.stack);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (action === 'get_png') {
|
|
38
|
-
try {
|
|
39
|
-
let png = await zenUml.getPng()
|
|
40
|
-
send_reply({ action: 'cmd_png', png })
|
|
36
|
+
let { code, theme, style, css } = ev.data.args;
|
|
37
|
+
await zenUml.render(code, theme);
|
|
38
|
+
send_ok();
|
|
41
39
|
} catch (e) {
|
|
42
40
|
send_error(e.message, e.stack);
|
|
43
41
|
}
|
|
@@ -46,7 +44,7 @@
|
|
|
46
44
|
if (action === 'catch_clicks') {
|
|
47
45
|
try {
|
|
48
46
|
const top_origin = ev.origin;
|
|
49
|
-
document.body.addEventListener('click', event => {
|
|
47
|
+
document.body.addEventListener('click', (event) => {
|
|
50
48
|
if (event.which !== 1) return;
|
|
51
49
|
if (event.metaKey || event.ctrlKey || event.shiftKey) return;
|
|
52
50
|
if (event.defaultPrevented) return;
|
|
@@ -56,7 +54,12 @@
|
|
|
56
54
|
while (el && el.nodeName !== 'A') el = el.parentNode;
|
|
57
55
|
if (!el || el.nodeName !== 'A') return;
|
|
58
56
|
|
|
59
|
-
if (
|
|
57
|
+
if (
|
|
58
|
+
el.hasAttribute('download') ||
|
|
59
|
+
el.getAttribute('rel') === 'external' ||
|
|
60
|
+
el.target
|
|
61
|
+
)
|
|
62
|
+
return;
|
|
60
63
|
|
|
61
64
|
event.preventDefault();
|
|
62
65
|
|
|
@@ -71,7 +74,7 @@
|
|
|
71
74
|
window.open(el.href, '_blank');
|
|
72
75
|
});
|
|
73
76
|
send_ok();
|
|
74
|
-
} catch(e) {
|
|
77
|
+
} catch (e) {
|
|
75
78
|
send_error(e.message, e.stack);
|
|
76
79
|
}
|
|
77
80
|
}
|
|
@@ -82,19 +85,19 @@
|
|
|
82
85
|
window.onerror = function (msg, url, lineNo, columnNo, error) {
|
|
83
86
|
if (msg.includes('module specifier “vue”')) {
|
|
84
87
|
// firefox only error, ignore
|
|
85
|
-
return false
|
|
88
|
+
return false;
|
|
86
89
|
}
|
|
87
90
|
try {
|
|
88
91
|
parent.postMessage({ action: 'error', value: error }, '*');
|
|
89
92
|
} catch (e) {
|
|
90
93
|
parent.postMessage({ action: 'error', value: msg }, '*');
|
|
91
94
|
}
|
|
92
|
-
}
|
|
95
|
+
};
|
|
93
96
|
|
|
94
|
-
window.addEventListener(
|
|
97
|
+
window.addEventListener('unhandledrejection', (event) => {
|
|
95
98
|
if (event.reason.message.includes('Cross-origin')) {
|
|
96
|
-
event.preventDefault()
|
|
97
|
-
return
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
return;
|
|
98
101
|
}
|
|
99
102
|
try {
|
|
100
103
|
parent.postMessage({ action: 'unhandledrejection', value: event.reason }, '*');
|
|
@@ -108,34 +111,39 @@
|
|
|
108
111
|
['clear', 'log', 'info', 'dir', 'warn', 'error', 'table'].forEach((level) => {
|
|
109
112
|
const original = console[level];
|
|
110
113
|
console[level] = (...args) => {
|
|
111
|
-
const msg = String(args[0])
|
|
114
|
+
const msg = String(args[0]);
|
|
112
115
|
if (
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
msg.includes('You are running a development build of Vue') ||
|
|
117
|
+
msg.includes('You are running the esm-bundler build of Vue')
|
|
115
118
|
) {
|
|
116
|
-
return
|
|
119
|
+
return;
|
|
117
120
|
}
|
|
118
121
|
const stringifiedArgs = stringify(args);
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
previous.args === stringifiedArgs
|
|
123
|
-
) {
|
|
124
|
-
parent !== window && parent.postMessage({ action: 'console', level, duplicate: true }, '*');
|
|
122
|
+
if (previous.level === level && previous.args && previous.args === stringifiedArgs) {
|
|
123
|
+
parent !== window &&
|
|
124
|
+
parent.postMessage({ action: 'console', level, duplicate: true }, '*');
|
|
125
125
|
} else {
|
|
126
126
|
previous = { level, args: stringifiedArgs };
|
|
127
127
|
|
|
128
128
|
try {
|
|
129
129
|
parent !== window && parent.postMessage({ action: 'console', level, args }, '*');
|
|
130
130
|
} catch (err) {
|
|
131
|
-
parent !== window &&
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
parent !== window &&
|
|
132
|
+
parent.postMessage(
|
|
133
|
+
{
|
|
134
|
+
action: 'console',
|
|
135
|
+
level,
|
|
136
|
+
args: args.map((a) => {
|
|
137
|
+
return a instanceof Error ? a.message : String(a);
|
|
138
|
+
}),
|
|
139
|
+
},
|
|
140
|
+
'*'
|
|
141
|
+
);
|
|
134
142
|
}
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
original(...args);
|
|
138
|
-
}
|
|
146
|
+
};
|
|
139
147
|
});
|
|
140
148
|
[
|
|
141
149
|
{ method: 'group', action: 'console_group' },
|
|
@@ -150,7 +158,6 @@
|
|
|
150
158
|
};
|
|
151
159
|
});
|
|
152
160
|
|
|
153
|
-
|
|
154
161
|
const original_trace = console.trace;
|
|
155
162
|
|
|
156
163
|
console.trace = (...args) => {
|
|
@@ -159,7 +166,6 @@
|
|
|
159
166
|
original_trace(...args);
|
|
160
167
|
};
|
|
161
168
|
|
|
162
|
-
|
|
163
169
|
function stringify(args) {
|
|
164
170
|
try {
|
|
165
171
|
return JSON.stringify(args);
|
|
@@ -167,18 +173,12 @@
|
|
|
167
173
|
return null;
|
|
168
174
|
}
|
|
169
175
|
}
|
|
170
|
-
})()
|
|
171
|
-
|
|
176
|
+
})();
|
|
172
177
|
</script>
|
|
173
178
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
<pre class="zenuml">
|
|
177
|
-
|
|
178
|
-
</pre>
|
|
179
|
+
<div id="diagram" class="diagram">
|
|
180
|
+
<pre class="zenuml"></pre>
|
|
179
181
|
</div>
|
|
180
182
|
<script type="module" src="src/main.ts"></script>
|
|
181
|
-
|
|
182
|
-
|
|
183
183
|
</body>
|
|
184
184
|
</html>
|
package/index.html
CHANGED
|
@@ -1,25 +1,39 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
|
-
<link rel=
|
|
5
|
-
<link
|
|
4
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
5
|
+
<link
|
|
6
|
+
rel="preload stylesheet"
|
|
7
|
+
as="style"
|
|
8
|
+
href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;700&display=swap"
|
|
9
|
+
/>
|
|
6
10
|
<!-- <link rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;700&display=swap'>-->
|
|
7
|
-
<style id="zenumlstyle"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
/*#diagram1 .sequence-diagram {*/
|
|
12
|
-
/* font-family: "Kalam", serif;*/
|
|
13
|
-
/*}*/
|
|
11
|
+
<style id="zenumlstyle">
|
|
12
|
+
/* Prefix your CSS rules with `#diagram` */
|
|
13
|
+
/*@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@300;400;700&display=swap');*/
|
|
14
|
+
/*!*@import url("https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@300;400;500;700&display=swap");*!*/
|
|
14
15
|
|
|
16
|
+
/*#diagram1 .sequence-diagram {*/
|
|
17
|
+
/* font-family: "Kalam", serif;*/
|
|
18
|
+
/*}*/
|
|
15
19
|
</style>
|
|
16
|
-
<meta charset="utf-8"
|
|
17
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge"
|
|
18
|
-
<meta name="viewport" content="width=device-width,initial-scale=1.0"
|
|
19
|
-
<link
|
|
20
|
-
|
|
20
|
+
<meta charset="utf-8" />
|
|
21
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
22
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
|
|
23
|
+
<link
|
|
24
|
+
rel="stylesheet"
|
|
25
|
+
href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.1.1/styles/default.min.css"
|
|
26
|
+
crossorigin="anonymous"
|
|
27
|
+
/>
|
|
21
28
|
<script src="https://cdn.jsdelivr.net/npm/codemirror@5.65.1/lib/codemirror.min.js"></script>
|
|
22
|
-
<link
|
|
29
|
+
<link
|
|
30
|
+
rel="stylesheet"
|
|
31
|
+
href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.1/codemirror.min.css"
|
|
32
|
+
crossorigin="anonymous"
|
|
33
|
+
integrity="sha512-uf06llspW44/LZpHzHT6qBOIVODjWtv4MxCricRxkzvopAlSWnTf6hpZTFxuuZcuNE9CBQhqE0Seu1CoRk84nQ=="
|
|
34
|
+
crossorigin="anonymous"
|
|
35
|
+
referrerpolicy="no-referrer"
|
|
36
|
+
/>
|
|
23
37
|
<title>ZenUML Core Demo</title>
|
|
24
38
|
<style>
|
|
25
39
|
.zenuml .CodeMirror {
|
|
@@ -35,20 +49,27 @@
|
|
|
35
49
|
editor and other layouts work properly.-->
|
|
36
50
|
<body class="zenuml">
|
|
37
51
|
<noscript>
|
|
38
|
-
<strong
|
|
52
|
+
<strong
|
|
53
|
+
>We're sorry but vue-sequence doesn't work properly without JavaScript enabled. Please
|
|
54
|
+
enable it to continue.</strong
|
|
55
|
+
>
|
|
39
56
|
</noscript>
|
|
40
57
|
<div class="m-1 grid grid-cols-6" id="diagram1">
|
|
41
58
|
<div class="col-span-2">
|
|
42
|
-
<textarea
|
|
59
|
+
<textarea
|
|
60
|
+
id="text"
|
|
61
|
+
class="col-span-1 m-1 border-2"
|
|
62
|
+
cols="30"
|
|
63
|
+
rows="200"
|
|
64
|
+
oninput="updateCode(this.value)"
|
|
65
|
+
></textarea>
|
|
43
66
|
</div>
|
|
44
67
|
<div class="col-span-4">
|
|
45
|
-
<pre class="zenuml">
|
|
46
|
-
|
|
47
|
-
</pre>
|
|
68
|
+
<pre class="zenuml"></pre>
|
|
48
69
|
</div>
|
|
49
70
|
</div>
|
|
50
71
|
<script>
|
|
51
|
-
const editor = CodeMirror.fromTextArea(document.getElementById(
|
|
72
|
+
const editor = CodeMirror.fromTextArea(document.getElementById('text'), {
|
|
52
73
|
lineNumbers: true,
|
|
53
74
|
singleCursorHeightPerLine: false,
|
|
54
75
|
});
|
|
@@ -64,12 +85,17 @@
|
|
|
64
85
|
}
|
|
65
86
|
}
|
|
66
87
|
|
|
67
|
-
editor.on(
|
|
68
|
-
waitUntil(
|
|
69
|
-
|
|
70
|
-
window.
|
|
71
|
-
}
|
|
72
|
-
|
|
88
|
+
editor.on('change', function (cm) {
|
|
89
|
+
waitUntil(
|
|
90
|
+
() => {
|
|
91
|
+
return window.zenUml;
|
|
92
|
+
},
|
|
93
|
+
() => {
|
|
94
|
+
window.zenUml.render(cm.getValue(), 'theme-default').then((r) => {
|
|
95
|
+
window.parentLogger.child({ name: 'index.html' }).debug('render resolved', r);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
);
|
|
73
99
|
// write cm.getValue() to localStorage
|
|
74
100
|
localStorage.setItem('zenuml-cm-code', cm.getValue());
|
|
75
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenuml/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.21",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/ZenUml/core.git"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"git:forget": "git rm -r --cached . && git add . && git commit -m \"Forget all ignored files\"",
|
|
34
34
|
"test:specs": "echo \"Error: test:specs is not supported\""
|
|
35
35
|
},
|
|
36
|
-
"main": "./dist/zenuml
|
|
36
|
+
"main": "./dist/zenuml.esm.mjs",
|
|
37
37
|
"types": "./types/index.d.ts",
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@types/assert": "^1.5.4",
|
|
@@ -97,8 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"extends": [
|
|
99
99
|
"plugin:vue/essential",
|
|
100
|
-
"eslint:recommended"
|
|
101
|
-
"@vue/typescript"
|
|
100
|
+
"eslint:recommended"
|
|
102
101
|
],
|
|
103
102
|
"rules": {},
|
|
104
103
|
"parserOptions": {
|