svelte-plots-basic 4.0.0 → 4.1.1
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/NEWS.md +76 -0
- package/README.md +8 -35
- package/package.json +10 -8
- package/src/2d/Rectangles.svelte +1 -1
package/NEWS.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Release notes
|
|
2
|
+
|
|
3
|
+
This file contains the full release history of `svelte-plots-basic`. The [README](README.md) shows only the most recent releases.
|
|
4
|
+
|
|
5
|
+
## 4.1.0
|
|
6
|
+
|
|
7
|
+
* Added a `svelte` export condition to every entry point, so bundlers recognize the package as a Svelte library. This matters when `prebundleSvelteLibraries` is disabled, where the components must be excluded from dependency pre-bundling.
|
|
8
|
+
* Added `./package.json` to the exported paths, so tools that read the package manifest can resolve it.
|
|
9
|
+
|
|
10
|
+
## 4.0.0
|
|
11
|
+
|
|
12
|
+
* Added horizontal legend layout and improved legend sizing and alignment.
|
|
13
|
+
* Improved PNG/SVG export reliability, export-dialog accessibility, and clipboard handling.
|
|
14
|
+
* Strengthened validation, automatic axis ticks, marker rendering, and component cleanup.
|
|
15
|
+
* Made subscripts, superscripts, and tick-factor labels consistent across modern browsers.
|
|
16
|
+
* Updated to `mdatools ^1.5.0`, now declared as a peer dependency to prevent incompatible duplicate instances.
|
|
17
|
+
|
|
18
|
+
## 3.4.0
|
|
19
|
+
|
|
20
|
+
* Added the `plotActions` property to `Axes` for adding custom buttons to the download panel.
|
|
21
|
+
* Added advanced validation for axis limits, text-label positions, heatmap breaks, and custom plot actions.
|
|
22
|
+
* Fixed text-label positioning and rotation when individual positions are provided.
|
|
23
|
+
* Fixed heatmaps with automatic, custom, or constant-value breaks.
|
|
24
|
+
* Added support for rectangular and constant-height 3D meshes.
|
|
25
|
+
* Improved PNG, SVG, and clipboard export by serializing a clone instead of modifying the visible plot.
|
|
26
|
+
* Fixed the advanced PNG export dialog so a default resolution is always selected, falling back to 300 dpi when necessary.
|
|
27
|
+
* Prevented plot controls from submitting an enclosing HTML form.
|
|
28
|
+
* Added package validation before publishing and synchronized Svelte 5 peer-dependency metadata.
|
|
29
|
+
* Fixed conditionally rendered axes, boxes, and legends so their parent state is cleared when they are removed.
|
|
30
|
+
* Improved heatmap interval processing and added automatically generated colormaps with more than 16 colors.
|
|
31
|
+
* Fixed `TextLegend` positioning at zero and strengthened finite-range validation for 3D axes.
|
|
32
|
+
* Reduced reactive and repeated allocation overhead for axis configuration, text measurement, PNG export, and colormap generation.
|
|
33
|
+
* Added dependency-free regression tests and made them run automatically before packaging.
|
|
34
|
+
* Documented the trust requirements for labels rendered as SVG/HTML markup.
|
|
35
|
+
|
|
36
|
+
## 3.3.0
|
|
37
|
+
|
|
38
|
+
* Added advanced "save as PNG" option where user can select size and resolution of the image as well as change the filename.
|
|
39
|
+
* several small improvements and bug fixes.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
## 3.2.1
|
|
43
|
+
|
|
44
|
+
* Added mouse click handler option for `Heatmap.svelte` component (returns row and column index of the element).
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## 3.1.1-3.1.6
|
|
48
|
+
|
|
49
|
+
* Fixed bug which sometimes caused an error when manual text tick labels provided.
|
|
50
|
+
* Added `markerSize` specification to legend items.
|
|
51
|
+
* Small improvements and bug fixes.
|
|
52
|
+
|
|
53
|
+
## 3.1.0
|
|
54
|
+
|
|
55
|
+
* Added possibility to reverse the axis, just swap the limit values.
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
## 3.0.0
|
|
59
|
+
|
|
60
|
+
New major release (v. 3.0.0, released 20/01/2025) introduces many breaking changes as the library has been re-written using Svelte 5. If you use previous versions of `svelte-plots-basic` in your projects, and do not want to change anything, stick to the latest 2.x.x version.
|
|
61
|
+
|
|
62
|
+
In addition to Svelte 5 syntax and functionality, this release also introduces a lot of improvements, such as better handling of axis ticks, new syntax for axis elements, etc. See examples below for inspiration. Here is a short list what has been changed from 2.x.x:
|
|
63
|
+
|
|
64
|
+
* **No more slots** — components `<Box>`, `<XAxis>`, `<YAxis>`, and `<ZAxis>` (for 3D) do not require attribute `slot` anymore. Moreover, you have to remove this attribute from all your old code in order to use the new version.
|
|
65
|
+
|
|
66
|
+
* **Axis labels** — in version 2.x.x. labels for x- and y-axis were a part of `<Axes>` component. From 3.x.x. they are part of corresponding axis components, for example:<br> `<XAxis label="x-axis label"/>`.
|
|
67
|
+
|
|
68
|
+
* **Support for subscripts and superscripts** — you can now use simple syntax for subscripts (`_`) and superscripts (`^`) in axis labels, tick labels, legend labels and plot title. For example, such labels as `'x^2'`, `x^-1` or `x_(34)` — will be correctly transformed to corresponding SVG text elements in order to visualize them correctly. You can also use HTML symbols, such as `α`.
|
|
69
|
+
|
|
70
|
+
* **Mouse events** — previosly, handling mouse events was done through a coplex system of manual events dispatched by `<Axes>` component. From 3.x.x this is much easier, almost every 2D series component (`<Rectangles>`, `<Bars>`, `<Points>`, `<Segments>`, `<Lines>`, `<Areas>`) can handle its own `onclick` event. You just need to provide a callback — a function that will be run if this event is fired. The callback should have one argument — id (position) of an element the click was made on. For example `<Points ... onclick={(id) => console.log(id)}>`. Because of this modification, the property `title` has been removed from all components. 2D component `<Axes>` also supports `onclick` event, it provides coordinates of the clicked point as arguments for the callback function. 3D plots do not support mouse events.
|
|
71
|
+
|
|
72
|
+
* **Save and copy 3D plots** — from 3.x.x you can also save and copy to clipboard 3D plots (same way as for 2D).
|
|
73
|
+
|
|
74
|
+
* **Doc strings** — every component has a corresponding doc string with description of its properties and a simple code example. It should be available when you move your mouse over the component tag in your editor/IDE if it supports this option (works in VSCode).
|
|
75
|
+
|
|
76
|
+
* **Properites** — from 3.x.x the naming of the properties is more consistent. For example, before the library used properties `borderColor` and `borderWidth` for areas, rectangels, bars and markers, while for lines, segments and multilines the similar properties were named as `lineColor` and `lineWidth`. Now they all have prefix `line*` if it is something about lines or segments and `face*` if it is somthing inside a closed contour. So no more `border*` properties.
|
package/README.md
CHANGED
|
@@ -15,6 +15,11 @@ These websites and web-applications use `svelte-plots-basic` library:
|
|
|
15
15
|
|
|
16
16
|
## News
|
|
17
17
|
|
|
18
|
+
### 4.1.0
|
|
19
|
+
|
|
20
|
+
* Added a `svelte` export condition to every entry point, so bundlers recognize the package as a Svelte library. This matters when `prebundleSvelteLibraries` is disabled, where the components must be excluded from dependency pre-bundling.
|
|
21
|
+
* Added `./package.json` to the exported paths, so tools that read the package manifest can resolve it.
|
|
22
|
+
|
|
18
23
|
### 4.0.0
|
|
19
24
|
|
|
20
25
|
* Added horizontal legend layout and improved legend sizing and alignment.
|
|
@@ -47,41 +52,7 @@ These websites and web-applications use `svelte-plots-basic` library:
|
|
|
47
52
|
* several small improvements and bug fixes.
|
|
48
53
|
|
|
49
54
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* Added mouse click handler option for `Heatmap.svelte` component (returns row and column index of the element).
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
### 3.1.1-3.1.6
|
|
56
|
-
|
|
57
|
-
* Fixed bug which sometimes caused an error when manual text tick labels provided.
|
|
58
|
-
* Added `markerSize` specification to legend items.
|
|
59
|
-
* Small improvements and bug fixes.
|
|
60
|
-
|
|
61
|
-
### 3.1.0
|
|
62
|
-
|
|
63
|
-
* Added possibility to reverse the axis, just swap the limit values.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### 3.0.0
|
|
67
|
-
|
|
68
|
-
New major release (v. 3.0.0, released 20/01/2025) introduces many breaking changes as the library has been re-written using Svelte 5. If you use previous versions of `svelte-plots-basic` in your projects, and do not want to change anything, stick to the latest 2.x.x version.
|
|
69
|
-
|
|
70
|
-
In addition to Svelte 5 syntax and functionality, this release also introduces a lot of improvements, such as better handling of axis ticks, new syntax for axis elements, etc. See examples below for inspiration. Here is a short list what has been changed from 2.x.x:
|
|
71
|
-
|
|
72
|
-
* **No more slots** — components `<Box>`, `<XAxis>`, `<YAxis>`, and `<ZAxis>` (for 3D) do not require attribute `slot` anymore. Moreover, you have to remove this attribute from all your old code in order to use the new version.
|
|
73
|
-
|
|
74
|
-
* **Axis labels** — in version 2.x.x. labels for x- and y-axis were a part of `<Axes>` component. From 3.x.x. they are part of corresponding axis components, for example:<br> `<XAxis label="x-axis label"/>`.
|
|
75
|
-
|
|
76
|
-
* **Support for subscripts and superscripts** — you can now use simple syntax for subscripts (`_`) and superscripts (`^`) in axis labels, tick labels, legend labels and plot title. For example, such labels as `'x^2'`, `x^-1` or `x_(34)` — will be correctly transformed to corresponding SVG text elements in order to visualize them correctly. You can also use HTML symbols, such as `α`.
|
|
77
|
-
|
|
78
|
-
* **Mouse events** — previosly, handling mouse events was done through a coplex system of manual events dispatched by `<Axes>` component. From 3.x.x this is much easier, almost every 2D series component (`<Rectangles>`, `<Bars>`, `<Points>`, `<Segments>`, `<Lines>`, `<Areas>`) can handle its own `onclick` event. You just need to provide a callback — a function that will be run if this event is fired. The callback should have one argument — id (position) of an element the click was made on. For example `<Points ... onclick={(id) => console.log(id)}>`. Because of this modification, the property `title` has been removed from all components. 2D component `<Axes>` also supports `onclick` event, it provides coordinates of the clicked point as arguments for the callback function. 3D plots do not support mouse events.
|
|
79
|
-
|
|
80
|
-
* **Save and copy 3D plots** — from 3.x.x you can also save and copy to clipboard 3D plots (same way as for 2D).
|
|
81
|
-
|
|
82
|
-
* **Doc strings** — every component has a corresponding doc string with description of its properties and a simple code example. It should be available when you move your mouse over the component tag in your editor/IDE if it supports this option (works in VSCode).
|
|
83
|
-
|
|
84
|
-
* **Properites** — from 3.x.x the naming of the properties is more consistent. For example, before the library used properties `borderColor` and `borderWidth` for areas, rectangels, bars and markers, while for lines, segments and multilines the similar properties were named as `lineColor` and `lineWidth`. Now they all have prefix `line*` if it is something about lines or segments and `face*` if it is somthing inside a closed contour. So no more `border*` properties.
|
|
55
|
+
Notes for earlier releases, including the list of breaking changes introduced in 3.0.0 when the library was re-written using Svelte 5, are available in the [full release notes](https://github.com/svkucheryavski/svelte-plots-basic/blob/main/NEWS.md).
|
|
85
56
|
|
|
86
57
|
|
|
87
58
|
## Security and label markup
|
|
@@ -104,6 +75,8 @@ or, to install it with yarn:
|
|
|
104
75
|
yarn add svelte-plots-basic
|
|
105
76
|
```
|
|
106
77
|
|
|
78
|
+
The components are always imported from the `svelte-plots-basic/2d` and `svelte-plots-basic/3d` subpaths, and the helper functions from `svelte-plots-basic/utils` and `svelte-plots-basic/constants`. There is no root import — the 2D and 3D groups deliberately share component names, such as `Axes` and `Points`, so importing from `svelte-plots-basic` directly is not supported and will fail to resolve.
|
|
79
|
+
|
|
107
80
|
|
|
108
81
|
## User tutorial (2D plots)
|
|
109
82
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-plots-basic",
|
|
3
3
|
"description": "Svelte components for creating simple plots",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.1.1",
|
|
5
5
|
"author": "Sergey Kucheryavskiy",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
"prepack": "npm run check && npm test"
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
|
-
"./constants":
|
|
16
|
-
"./utils":
|
|
17
|
-
"./2d":
|
|
18
|
-
"./2d/*.svelte": "./src/2d/*.svelte",
|
|
19
|
-
"./3d":
|
|
20
|
-
"./3d/*.svelte": "./src/3d/*.svelte"
|
|
15
|
+
"./constants": { "svelte": "./src/constants.js", "default": "./src/constants.js" },
|
|
16
|
+
"./utils": { "svelte": "./src/methods.js", "default": "./src/methods.js" },
|
|
17
|
+
"./2d": { "svelte": "./src/2d/index.js", "default": "./src/2d/index.js" },
|
|
18
|
+
"./2d/*.svelte": { "svelte": "./src/2d/*.svelte", "default": "./src/2d/*.svelte" },
|
|
19
|
+
"./3d": { "svelte": "./src/3d/index.js", "default": "./src/3d/index.js" },
|
|
20
|
+
"./3d/*.svelte": { "svelte": "./src/3d/*.svelte", "default": "./src/3d/*.svelte" },
|
|
21
|
+
"./package.json": "./package.json"
|
|
21
22
|
},
|
|
22
23
|
"devDependencies": {
|
|
23
24
|
"mdatools": "^1.5.0",
|
|
@@ -34,7 +35,8 @@
|
|
|
34
35
|
"svelte plots"
|
|
35
36
|
],
|
|
36
37
|
"files": [
|
|
37
|
-
"src"
|
|
38
|
+
"src",
|
|
39
|
+
"NEWS.md"
|
|
38
40
|
],
|
|
39
41
|
"repository": {
|
|
40
42
|
"type": "git",
|
package/src/2d/Rectangles.svelte
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
105
105
|
<g class="series {className}" style={barsStyleStr} onclick={(e) => handleClick(e, 'rect', onclick)} >
|
|
106
106
|
{#each left as v, i}
|
|
107
|
-
<rect x={rx[i]} y={ry[i]} width={rw[i]} height={rh[i]} />
|
|
107
|
+
<rect x={rx[i]} y={ry[i]} width={Math.abs(rw[i])} height={rh[i]} />
|
|
108
108
|
{/each}
|
|
109
109
|
</g>
|
|
110
110
|
{/if}
|