@zenuml/core 2.0.18 → 2.0.20
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/.nvmrc +1 -0
- package/README.md +4 -17
- package/{dist/cy → cy}/defect-406-alt-under-creation.html +7 -6
- package/{dist/cy → cy}/smoke-creation.html +1 -0
- package/{dist/cy → cy}/smoke-fragment-issue.html +1 -0
- package/{dist/cy → cy}/smoke-fragment.html +1 -0
- package/{dist/cy → cy}/smoke-interaction.html +1 -0
- package/{dist/cy → cy}/smoke-return.html +1 -0
- package/{dist/cy → cy}/smoke.html +3 -1
- package/cypress.config.ts +14 -0
- package/dist/style.css +1 -1
- package/dist/zenuml-core.mjs +13175 -13212
- package/dist/zenuml-core.umd.js +94 -94
- package/docs/asciidoc/contributor.adoc +0 -42
- package/{dist/embed.html → embed.html} +13 -2
- package/index.html +2 -2
- package/package.json +11 -9
- package/pnpm-lock.yaml +198 -132
- package/vite.config.js +16 -4
- package/vite.config.lib.js +23 -0
- package/cypress.json +0 -7
- package/docs/invalid-host-header-error.md +0 -20
- package/vue.config.spec.js +0 -8
- package/vue.temp.config.js +0 -76
|
@@ -14,48 +14,6 @@ yarn build
|
|
|
14
14
|
yarn build:site
|
|
15
15
|
....
|
|
16
16
|
|
|
17
|
-
=== Customize vue.config.js
|
|
18
|
-
|
|
19
|
-
==== Inline SVG
|
|
20
|
-
When we build the library, SVG must be inlined.
|
|
21
|
-
|
|
22
|
-
An inlined SVG looks like this:
|
|
23
|
-
....
|
|
24
|
-
<img src='data:image/svg+xml;base64,<svg ... > ... </svg>'>
|
|
25
|
-
....
|
|
26
|
-
|
|
27
|
-
[NOTE]
|
|
28
|
-
====
|
|
29
|
-
[TODO] Note that we use the `base64` encoding as it is the default behaviour of webpack 5
|
|
30
|
-
asset module `asset/inline`. However, `utf8` has https://www.npmjs.com/package/svg-url-loader[the following advantages]:
|
|
31
|
-
|
|
32
|
-
1. Resulting string is shorter (can be ~2 times shorter for 2K-sized icons);
|
|
33
|
-
2. Resulting string will be compressed better when using gzip compression;
|
|
34
|
-
3. Browser parses utf-8 encoded string faster than its base64 equivalent.
|
|
35
|
-
|
|
36
|
-
This can be implemented with https://webpack.js.org/guides/asset-modules/#custom-data-uri-generator[custom data URI generator].
|
|
37
|
-
====
|
|
38
|
-
The default loader build in vue cli service for svg files will not inline the SVG,
|
|
39
|
-
but give a url (relative path) to the svg resource like this:
|
|
40
|
-
....
|
|
41
|
-
<img src="/assets/arrow.svg">
|
|
42
|
-
....
|
|
43
|
-
Client applications will not be able to load the SVG properly.
|
|
44
|
-
|
|
45
|
-
To inline the SVG, we need to use https://webpack.js.org/guides/asset-modules/#inlining-assets[asset module `asset/inline`].
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
[source, javascript]
|
|
49
|
-
....
|
|
50
|
-
const svgRule = config.module.rule('svg')
|
|
51
|
-
svgRule.store.clear();
|
|
52
|
-
svgRule
|
|
53
|
-
.test(/\.svg$/) // required because of store.clear()
|
|
54
|
-
.type('asset/inline') // <1>
|
|
55
|
-
.end()
|
|
56
|
-
....
|
|
57
|
-
<1> `asset/inline` exports a data URI of the asset. Previously achievable by using `url-loader`. https://webpack.js.org/guides/asset-modules/#inlining-assets[See more]
|
|
58
|
-
|
|
59
17
|
== Demo pages
|
|
60
18
|
In the public folder, there are some demo pages for testing the library.
|
|
61
19
|
|
|
@@ -34,6 +34,15 @@
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
if (action === 'get_png') {
|
|
38
|
+
try {
|
|
39
|
+
let png = await zenUml.getPng()
|
|
40
|
+
send_reply({ action: 'cmd_png', png })
|
|
41
|
+
} catch (e) {
|
|
42
|
+
send_error(e.message, e.stack);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
if (action === 'catch_clicks') {
|
|
38
47
|
try {
|
|
39
48
|
const top_origin = ev.origin;
|
|
@@ -163,11 +172,13 @@
|
|
|
163
172
|
</script>
|
|
164
173
|
|
|
165
174
|
|
|
166
|
-
<div id="diagram" class="diagram">
|
|
175
|
+
<div id="diagram" class="diagram" style="text-align: center">
|
|
167
176
|
<pre class="zenuml">
|
|
168
177
|
|
|
169
178
|
</pre>
|
|
170
179
|
</div>
|
|
171
|
-
|
|
180
|
+
<script type="module" src="src/main.ts"></script>
|
|
181
|
+
|
|
182
|
+
|
|
172
183
|
</body>
|
|
173
184
|
</html>
|
package/index.html
CHANGED
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
editor.on("change", function(cm) {
|
|
68
68
|
waitUntil( () => {return window.zenUml}, () => {
|
|
69
69
|
window.zenUml.render(cm.getValue(), 'theme-default').then(r => {
|
|
70
|
-
window.parentLogger.child({
|
|
70
|
+
window.parentLogger.child({name: 'index.html'}).debug('render resolved', r);
|
|
71
71
|
});
|
|
72
72
|
});
|
|
73
73
|
// write cm.getValue() to localStorage
|
|
@@ -79,6 +79,6 @@
|
|
|
79
79
|
editor.setValue(code);
|
|
80
80
|
}
|
|
81
81
|
</script>
|
|
82
|
-
<script type="module" src="src/main.ts"></script>
|
|
82
|
+
<script type="module" src="./src/main.ts"></script>
|
|
83
83
|
</body>
|
|
84
84
|
</html>
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenuml/core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.20",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/ZenUml/core.git"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
|
-
"dev": "vite",
|
|
10
|
-
"build:site": "
|
|
11
|
-
"build": "vite build",
|
|
9
|
+
"dev": "vite dev --port 8080",
|
|
10
|
+
"build:site": "vite build",
|
|
11
|
+
"build": "vite build -c vite.config.lib.js",
|
|
12
12
|
"build:report": "vue-cli-service build --report --target lib --inline-vue --name zenuml/core ./src/core.ts",
|
|
13
13
|
"test:unit": "jest",
|
|
14
14
|
"test": "vitest",
|
|
15
15
|
"test:unit:watch": "pnpm run antlr && vue-cli-service test:unit --watch",
|
|
16
16
|
"cy": "cypress run",
|
|
17
17
|
"cy:open": "cypress open",
|
|
18
|
+
"cy:smoke": "cypress run --spec cypress/e2e/smoke.spec.js",
|
|
18
19
|
"lint": "vue-cli-service lint",
|
|
19
20
|
"antlr:setup": "python3 -m pip install antlr4-tools",
|
|
20
21
|
"antlr:generate": "pwd && cd ./src/g4-units/hello-world && antlr4 Hello.g4",
|
|
@@ -32,19 +33,19 @@
|
|
|
32
33
|
"git:forget": "git rm -r --cached . && git add . && git commit -m \"Forget all ignored files\"",
|
|
33
34
|
"test:specs": "echo \"Error: test:specs is not supported\""
|
|
34
35
|
},
|
|
35
|
-
"main": "./dist/zenuml
|
|
36
|
+
"main": "./dist/zenuml-core.mjs",
|
|
36
37
|
"types": "./types/index.d.ts",
|
|
37
38
|
"dependencies": {
|
|
38
39
|
"@types/assert": "^1.5.4",
|
|
39
40
|
"@types/ramda": "^0.28.0",
|
|
40
41
|
"antlr4": "^4.11.0",
|
|
41
|
-
"color-string": "1.5.
|
|
42
|
+
"color-string": "^1.5.5",
|
|
42
43
|
"dom-to-image-more": "^2.9.5",
|
|
43
44
|
"file-saver": "^2.0.5",
|
|
44
45
|
"highlight.js": "^10.1.1",
|
|
45
46
|
"html-to-image": "^1.9.0",
|
|
46
47
|
"lodash": "^4.17.20",
|
|
47
|
-
"marked": "^
|
|
48
|
+
"marked": "^4.0.10",
|
|
48
49
|
"pino": "^8.7.0",
|
|
49
50
|
"postcss": "^8.4.19",
|
|
50
51
|
"ramda": "^0.28.0",
|
|
@@ -63,13 +64,13 @@
|
|
|
63
64
|
"@types/node": "latest",
|
|
64
65
|
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
65
66
|
"@typescript-eslint/parser": "^5.46.1",
|
|
66
|
-
"@vue/eslint-config-typescript": "^8.0.0",
|
|
67
67
|
"@vue/test-utils": "1.3.3",
|
|
68
68
|
"@vue/vue2-jest": "^27.0.0",
|
|
69
69
|
"autoprefixer": "^10.4.13",
|
|
70
70
|
"babel-eslint": "^10.1.0",
|
|
71
71
|
"babel-jest": "^27.5.1",
|
|
72
|
-
"
|
|
72
|
+
"concurrently": "^7.5.0",
|
|
73
|
+
"cypress": "10",
|
|
73
74
|
"cypress-plugin-snapshots": "^1.4.4",
|
|
74
75
|
"eslint": "^8.30.0",
|
|
75
76
|
"eslint-plugin-vue": "^8.7.1",
|
|
@@ -82,6 +83,7 @@
|
|
|
82
83
|
"svg-url-loader": "^6.0.0",
|
|
83
84
|
"terser-webpack-plugin": "^3.0.6",
|
|
84
85
|
"ts-jest": "^27.1.5",
|
|
86
|
+
"ts-node": "^10.9.1",
|
|
85
87
|
"typescript": "^4.7.4",
|
|
86
88
|
"vite": "^4.0.1",
|
|
87
89
|
"vite-plugin-vue2": "^2.0.2",
|