Skip to content

Commit 7a51351

Browse files
authored
v2.0.5 (#73)
v2.0.5
2 parents f30ba33 + ca77d5b commit 7a51351

File tree

116 files changed

+11269
-24461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+11269
-24461
lines changed

.eslintrc.js

Lines changed: 11 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,16 @@
1-
const common = {
2-
env: {
3-
node: true,
4-
es6: true,
5-
},
6-
plugins: ["prettier", "markdown"],
1+
module.exports = {
2+
env: { browser: true, es2020: true },
73
extends: [
8-
"airbnb-base",
9-
"plugin:jest/all",
10-
"plugin:markdown/recommended", // REF: https://github.com/eslint/eslint-plugin-markdown/blob/main/lib/index.js
11-
"prettier",
4+
"eslint:recommended",
5+
"plugin:@typescript-eslint/recommended",
6+
"plugin:react-hooks/recommended",
127
],
13-
ignorePatterns: ["node_modules/", "dist/", "coverage/"],
8+
parser: "@typescript-eslint/parser",
9+
parserOptions: { ecmaVersion: "latest", sourceType: "module" },
10+
plugins: ["react-refresh"],
1411
rules: {
15-
"prettier/prettier": "error",
16-
"jest/no-disabled-tests": "warn",
17-
"jest/no-focused-tests": "error",
18-
"jest/no-identical-title": "error",
19-
"jest/prefer-to-have-length": "warn",
20-
"jest/valid-expect": "error",
21-
"jest/expect-expect": "off",
22-
"jest/prefer-expect-assertions": "off",
23-
"jest/no-test-return-statement": "off",
24-
"import/prefer-default-export": "off",
25-
"import/extensions": "off",
26-
"no-console": "off",
27-
"no-iterator": "off",
28-
"no-restricted-syntax": "off",
29-
"no-await-in-loop": "off",
30-
"consistent-return": "off",
31-
"no-shadow": "off",
32-
"no-unused-vars": "off",
12+
"react-refresh/only-export-components": "off",
13+
"@typescript-eslint/no-non-null-assertion": "off",
14+
"@typescript-eslint/no-empty-interface": "off",
3315
},
3416
};
35-
36-
module.exports = {
37-
// ...common,
38-
root: true,
39-
overrides: [
40-
{
41-
/*
42-
eslint-plugin-markdown only finds javascript code block snippet.
43-
For specific spec, refer to https://github.com/eslint/eslint-plugin-markdown
44-
*/
45-
...common,
46-
files: ["**/*.js"],
47-
},
48-
{
49-
/*
50-
eslint-plugin-markdown only finds javascript code block snippet.
51-
For specific spec, refer to https://github.com/eslint/eslint-plugin-markdown
52-
*/
53-
files: ["**/*.md"],
54-
processor: "markdown/markdown",
55-
},
56-
{
57-
...common,
58-
// In eslint-plugin-markdown v2, configuration for fenced code blocks is separate from the
59-
// containing Markdown file. Each code block has a virtual filename
60-
// appended to the Markdown file's path.
61-
files: ["**/*.md/*.js"],
62-
// Configuration for fenced code blocks goes with the override for
63-
// the code block's virtual filename, for example:
64-
parserOptions: {
65-
ecmaFeatures: {
66-
impliedStrict: true,
67-
},
68-
},
69-
rules: {
70-
...common.rules,
71-
"import/no-unresolved": "off",
72-
"import/no-extraneous-dependencies": "off",
73-
},
74-
},
75-
{
76-
...common,
77-
files: ["**/*.ts"],
78-
parser: "@typescript-eslint/parser",
79-
parserOptions: {
80-
project: "./tsconfig.json", // REF: https://www.npmjs.com/package/eslint-config-airbnb-typescript
81-
},
82-
env: common.env,
83-
plugins: [...common.plugins, "@typescript-eslint"],
84-
extends: [
85-
...common.extends,
86-
"airbnb-typescript/base", // "base" does not include tsx rules. REF: https://www.npmjs.com/package/eslint-config-airbnb-typescript
87-
"plugin:@typescript-eslint/recommended",
88-
"plugin:import/errors",
89-
"plugin:import/warnings",
90-
"plugin:import/typescript",
91-
"prettier", // Let prettier have high priority
92-
],
93-
rules: {
94-
...common.rules,
95-
"@typescript-eslint/explicit-function-return-type": "off",
96-
"@typescript-eslint/explicit-module-boundary-types": "off",
97-
},
98-
settings: {
99-
"import/resolver": {
100-
typescript: {},
101-
},
102-
},
103-
},
104-
],
105-
};

README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@
44

55
This plugin allows you to export the visualization with better quality and more settings.
66

7+
## Table of contents
8+
9+
- [Configuarion](#configuration)
10+
- [Export settings](#export-settings)
11+
- [Snapping](#snapping)
12+
- [Full-size export](#full-size-export)
13+
- [Pre-defined formats](#pre-defined-formats)
14+
- [Background Export](#background-export)
15+
- [Choosing format](#choosing-format)
16+
- [Annotations](#annotations)
17+
718
## Configuration
819

920
Plugin is available through a custom action:
@@ -33,7 +44,8 @@ This will open the plugin in another tab in your browser. In the plugin, you can
3344
- **Pre-defined sizes** - you can also go for the pre-defined document sizes (for instance, for printing) and _fit_ your visualization into it, using panning and zooming. If you are aiming at embedding your exported images into presentations, please refer to the [pre-defined PowerPoint slide sizes](https://support.microsoft.com/en-us/office/change-the-size-of-your-slides-040a811c-be43-40b9-8d04-0de5ed79987e) - for the modern system that would be `Widescreen`. For printing, you have a selection of popular document sizes, from A3 to letterhead. It is preferable to use SVG file format for printing, as it is vectorial and will produce higher quality prints. Note that if you select the pre-defined document size, the parts of the graph that are not fitting into it, will be clipped.
3445

3546
## Snapping
36-
Snapping allows you to manually align each node linearly with other nodes in the visualization.
47+
48+
Snapping allows you to manually align each node linearly with other nodes in the visualization.
3749

3850
## Full-size export
3951

@@ -69,3 +81,40 @@ Currently the plugin offers two formats: SVG and PNG. You can choose the format
6981

7082
- <abbr title="Scalable Vector Graphics">SVG</abbr> - this is the vector format that would offer the best quality and file size for printing and sharing on the web. It has all the fonts and images embedded into the document. It is also editable by the popular vector graphics applications such as [Adobe Illustrator](https://www.adobe.com/), [Inkscape](https://inkscape.org/) and lots of others. They can also be resized and embedded into the presentations and documents without any quality loss.
7183
- <abbr title="Portable Network Graphics">PNG</abbr> - this is the raster format and its advantage is that it can be viewed by more applications, such as default image viewers on any operating system. Resizing the PNG documents will cause blurriness and degraded quality.
84+
85+
## Annotations
86+
87+
You can add annotations to the exported image. To do that, you need to select a type of annotation from the annotations bar
88+
89+
<img src="./images/annotations-bar.png" alt="Annotations bar" />
90+
91+
Currently, the plugin supports the following types of annotations:
92+
93+
- Text box
94+
- Arrow
95+
96+
### Adding text boxes
97+
98+
To add a text box, click on the "Text box" button in the annotations bar. Then, draw a rectangle on the screen. The text box will be added to the image.
99+
100+
<img src="./images/adding-text-annotation.gif" alt="Adding text annotation" />
101+
102+
You can change the text in the text box by clicking and focusing on the text box. You can also change the size of the text box by dragging the corners of the rectangle, or move it around by grabbing the box by one of the sides. You can also delete the text box by selecting it and pressing the <kbd>Backspace</kbd> key.
103+
104+
<img src="./images/editing-text-annotation.gif" alt="Text box editing" />
105+
106+
You can change the style of the text, including the font, font size, font color, and background color. To do that, click on the text box and select the "Text" tab in the settings panel.
107+
108+
### Adding arrows
109+
110+
To add an arrow, click on the "Arrow" button in the annotations bar. Then, click on the start point of the arrow and drag it to the end point. The arrow will be added to the image.
111+
112+
<img src="./images/adding-arrow-annotation.gif" alt="Adding arrow annotation" />
113+
114+
You can edit the arrow by clicking on it and selecting the "Arrow" tab in the settings panel. You can change the color, the width, and the direction of an arrow.
115+
116+
### Combining text boxes and arrows
117+
118+
You can combine and connect text boxes with arrows and lines. For that, you need to drag one of the endpoints of the line close to the text box. The line will snap to the text box and will be connected to it. Now you can move the text box around and the line will follow it.
119+
120+
<img src="./images/connect-arrow-text.gif" alt="Combining annotations" />

tests/e2e/codecept.conf.js renamed to codecept.conf.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
require("ts-node/register");
2-
3-
const { setHeadlessWhen, setWindowSize } = require("@codeceptjs/configure");
1+
/// <reference types='codeceptjs' />
2+
import { setHeadlessWhen, setWindowSize } from "@codeceptjs/configure";
43

54
setHeadlessWhen(process.env.CI);
65

@@ -14,8 +13,11 @@ const emulateOptions = process.env.TEST_RETINA
1413
? { isMobile: false, deviceScaleFactor: 2 }
1514
: { isMobile: false, deviceScaleFactor: 1 };
1615

17-
exports.config = {
18-
output: "../../reports/html/e2e",
16+
/** @type {CodeceptJS.MainConfig} */
17+
export const config: CodeceptJS.MainConfig = {
18+
// this is irreleavnt by the way
19+
tests: "./tests/e2e/*_test.ts",
20+
output: "./reports/html/e2e",
1921
timeout: 25,
2022
helpers: {
2123
Playwright: {
@@ -30,12 +32,12 @@ exports.config = {
3032
},
3133
},
3234
CustomHelper: {
33-
require: "./helpers/customHelper",
35+
require: "./tests/e2e/helpers/customHelper",
3436
},
3537
},
3638
gherkin: {
37-
features: "./features/**/*.feature",
38-
steps: "./steps/**/*.ts",
39+
features: "./tests/e2e/features/**/*.feature",
40+
steps: "./tests/e2e/steps/**/*.ts",
3941
},
4042
name: "lkeplugin-image-export",
4143
grep: process.env.GREP,
@@ -47,7 +49,7 @@ exports.config = {
4749
},
4850
stepByStepReport: {
4951
enabled: process.env.CI,
50-
output: "../../reports/html/e2e",
52+
output: "./reports/html/e2e",
5153
ignoreSteps: ["grab*", "wait*"],
5254
fullPageScreenshots: true,
5355
},

images/adding-arrow-annotation.gif

535 KB
Loading

images/adding-text-annotation.gif

515 KB
Loading

images/annotations-bar.png

7.15 KB
Loading

images/connect-arrow-text.gif

536 KB
Loading

images/editing-text-annotation.gif

846 KB
Loading

index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Image export plugin</title>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<link rel="icon" type="image/x-icon" href="./src/assets/favicon.ico" />
8+
</head>
9+
10+
<body>
11+
<div class="page-container" id="root"></div>
12+
<script src="./src/main.tsx" type="module"></script>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)