@matfsw/docusaurus-plantuml-plugin 1.0.1 → 1.0.3
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/CHANGELOG.md +43 -1
- package/README.md +8 -1
- package/dist/theme/PlantUmlDiagram/useZoomPan.js +22 -10
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.3]
|
|
11
|
+
|
|
12
|
+
### Security
|
|
13
|
+
|
|
14
|
+
- `copy-webpack-plugin` `12` → `14`, which moves the transitive `serialize-javascript`
|
|
15
|
+
dependency to `7.0.7`. That closes a high-severity advisory (RCE via `RegExp.flags`) and a
|
|
16
|
+
denial-of-service advisory in the version the plugin previously pulled in. The dependency is
|
|
17
|
+
used at build time and never reaches a site visitor's browser.
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- `engines.node` is now `>= 20.9.0`, following `copy-webpack-plugin@14`. In practice this is
|
|
22
|
+
not a restriction: the Node 20 LTS line begins at `20.9.0`, so any supported Node 20 already
|
|
23
|
+
satisfies it.
|
|
24
|
+
- Development dependencies updated: `globals` `16` → `17`, `@types/node` `22` → `26`, and
|
|
25
|
+
React `18` → `19` for the unit-test environment. The plugin still supports React 18 and 19;
|
|
26
|
+
the example site continues to exercise React 18 end to end, so both are covered.
|
|
27
|
+
- GitHub Actions updated: `actions/checkout` `5` → `7`, `actions/setup-node` `5` → `7`,
|
|
28
|
+
`actions/upload-artifact` `4` → `7`.
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- Resets of the zoom view now have exactly one owner. The listener effect also reset on every
|
|
33
|
+
re-attach, duplicating the effect keyed on the rendered picture; any re-attach for an
|
|
34
|
+
unrelated reason would have silently discarded a zoom the reader had chosen.
|
|
35
|
+
- A unit test built a fake React element from its internal `$$typeof` symbol, which React 19
|
|
36
|
+
renamed. It now uses a real element, so it no longer depends on React internals.
|
|
37
|
+
- The maximize round-trip test no longer assumes effect flush order, which made it flaky on
|
|
38
|
+
CI. It asserts the same value, so a genuinely wrong transform still fails.
|
|
39
|
+
|
|
40
|
+
## [1.0.2]
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
|
|
44
|
+
- The zoom buttons and keyboard shortcuts now zoom about the viewport's top-left corner rather
|
|
45
|
+
than its centre. A diagram that fits its viewport is left-aligned, so the empty space is to
|
|
46
|
+
its right and below; zooming about the centre scaled that empty space and pushed the diagram
|
|
47
|
+
off the top and left edges, most visibly on a maximized diagram. Wheel zoom continues to
|
|
48
|
+
track the pointer.
|
|
49
|
+
|
|
10
50
|
## [1.0.1]
|
|
11
51
|
|
|
12
52
|
### Fixed
|
|
@@ -86,7 +126,9 @@ Initial release.
|
|
|
86
126
|
opt-out.
|
|
87
127
|
- Plugin option validation that rejects unknown keys and out-of-range values at build time.
|
|
88
128
|
|
|
89
|
-
[Unreleased]: https://github.com/matf/docusaurus-plantuml-plugin/compare/v1.0.
|
|
129
|
+
[Unreleased]: https://github.com/matf/docusaurus-plantuml-plugin/compare/v1.0.3...HEAD
|
|
130
|
+
[1.0.3]: https://github.com/matf/docusaurus-plantuml-plugin/compare/v1.0.2...v1.0.3
|
|
131
|
+
[1.0.2]: https://github.com/matf/docusaurus-plantuml-plugin/compare/v1.0.1...v1.0.2
|
|
90
132
|
[1.0.1]: https://github.com/matf/docusaurus-plantuml-plugin/compare/v1.0.0...v1.0.1
|
|
91
133
|
[1.0.0]: https://github.com/matf/docusaurus-plantuml-plugin/compare/v0.1.0...v1.0.0
|
|
92
134
|
[0.1.0]: https://github.com/matf/docusaurus-plantuml-plugin/releases/tag/v0.1.0
|
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@ them are exported.
|
|
|
42
42
|
| Requirement | Supported |
|
|
43
43
|
| --------------- | -------------------------------------------------------------------------------------- |
|
|
44
44
|
| Docusaurus | `3.5.0` and later `3.x` |
|
|
45
|
-
| Node.js (build) | `>= 20`
|
|
45
|
+
| Node.js (build) | `>= 20.9.0` (the Node 20 LTS line) |
|
|
46
46
|
| React | `18.x` or `19.x` (matching your Docusaurus install) |
|
|
47
47
|
| Bundler | webpack (default) and Rspack (`future.v4` / `@docusaurus/faster`) |
|
|
48
48
|
| PlantUML engine | `@plantuml/core` `1.2026.6` |
|
|
@@ -277,6 +277,13 @@ The diagram viewport is focusable. Once focused:
|
|
|
277
277
|
Keys with Ctrl, Cmd or Alt held are left to the browser, so shortcuts such as Ctrl + 0 keep
|
|
278
278
|
working, and `Tab` always moves on — the diagram is never a keyboard trap.
|
|
279
279
|
|
|
280
|
+
The toolbar buttons and the keyboard zoom about the **top-left corner** of the viewport, while
|
|
281
|
+
the wheel zooms about the **pointer**. That difference is deliberate: a diagram rarely fills its
|
|
282
|
+
viewport, and one that fits is left-aligned, so the empty space sits to its right and below.
|
|
283
|
+
Zooming about the centre would scale that empty space and push the diagram off the top and left
|
|
284
|
+
edges — most visibly when maximized. Anchoring at the top-left grows the diagram into the empty
|
|
285
|
+
space instead and keeps it visible as long as possible.
|
|
286
|
+
|
|
280
287
|
Scale is limited to 0.25×–8×, and the view resets to 100% whenever the diagram source or the
|
|
281
288
|
site colour mode changes.
|
|
282
289
|
|
|
@@ -54,12 +54,19 @@ export function useZoomPan({ enabled, resetKey }) {
|
|
|
54
54
|
const reset = useCallback(() => {
|
|
55
55
|
apply(IDENTITY);
|
|
56
56
|
}, [apply]);
|
|
57
|
-
/**
|
|
57
|
+
/**
|
|
58
|
+
* Zooms about the viewport's top-left corner.
|
|
59
|
+
*
|
|
60
|
+
* Not the centre: a diagram rarely fills its viewport, and a diagram that fits is
|
|
61
|
+
* left-aligned, so the empty space sits to its right and below. Zooming about the centre
|
|
62
|
+
* scales that empty space too and pushes the diagram off the top and left edges — most
|
|
63
|
+
* visibly when maximized. Anchoring at the top-left leaves a left-aligned diagram exactly
|
|
64
|
+
* where it is and grows it into the empty space, keeping it visible as long as possible.
|
|
65
|
+
*
|
|
66
|
+
* Wheel zoom still tracks the pointer, which is what direct manipulation should do.
|
|
67
|
+
*/
|
|
58
68
|
const zoomByStep = useCallback((factor) => {
|
|
59
|
-
|
|
60
|
-
const focalX = (viewport?.clientWidth ?? 0) / 2;
|
|
61
|
-
const focalY = (viewport?.clientHeight ?? 0) / 2;
|
|
62
|
-
apply(zoomAbout(transformRef.current, factor, focalX, focalY));
|
|
69
|
+
apply(zoomAbout(transformRef.current, factor, 0, 0));
|
|
63
70
|
}, [apply]);
|
|
64
71
|
const zoomIn = useCallback(() => zoomByStep(SCALE_STEP), [zoomByStep]);
|
|
65
72
|
const zoomOut = useCallback(() => zoomByStep(1 / SCALE_STEP), [zoomByStep]);
|
|
@@ -114,8 +121,6 @@ export function useZoomPan({ enabled, resetKey }) {
|
|
|
114
121
|
const viewport = viewportRef.current;
|
|
115
122
|
if (!viewport)
|
|
116
123
|
return undefined;
|
|
117
|
-
// The layer node is replaced whenever the rendered SVG changes; start from a clean view.
|
|
118
|
-
write(IDENTITY);
|
|
119
124
|
let dragging = false;
|
|
120
125
|
let pointerId = null;
|
|
121
126
|
let startX = 0;
|
|
@@ -248,9 +253,16 @@ export function useZoomPan({ enabled, resetKey }) {
|
|
|
248
253
|
// the listeners against a clean view.
|
|
249
254
|
}, [apply, enabled, measure, resetKey, write]);
|
|
250
255
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
256
|
+
* The single owner of "reset the view".
|
|
257
|
+
*
|
|
258
|
+
* `resetKey` identifies the rendered picture, so this covers both a new diagram and a
|
|
259
|
+
* colour-mode change — including the case where a cache hit resolves before any phase is
|
|
260
|
+
* reported and the component goes `ready -> ready` without the layer ever unmounting.
|
|
261
|
+
*
|
|
262
|
+
* The listener effect deliberately does *not* also reset. Its dependencies are a superset of
|
|
263
|
+
* this one's, so any re-attach for an unrelated reason — a remount, or a callback identity
|
|
264
|
+
* change from a future refactor — would silently throw away a zoom the reader had chosen.
|
|
265
|
+
* One owner means a reset happens when the picture changes, and at no other time.
|
|
254
266
|
*/
|
|
255
267
|
useEffect(() => {
|
|
256
268
|
if (!enabled)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@matfsw/docusaurus-plantuml-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Render PlantUML diagrams in Docusaurus 3 entirely in the browser - no Java, no PlantUML server, no CDN.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docusaurus",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"CHANGELOG.md"
|
|
42
42
|
],
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=20.
|
|
44
|
+
"node": ">=20.9.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"clean": "node scripts/clean.mjs",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
72
|
"@plantuml/core": "^1.2026.6",
|
|
73
|
-
"copy-webpack-plugin": "^
|
|
73
|
+
"copy-webpack-plugin": "^14.0.0",
|
|
74
74
|
"dompurify": "^3.2.7"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
@@ -91,19 +91,19 @@
|
|
|
91
91
|
"@testing-library/jest-dom": "^6.9.1",
|
|
92
92
|
"@testing-library/react": "^16.3.0",
|
|
93
93
|
"@testing-library/user-event": "^14.6.1",
|
|
94
|
-
"@types/node": "^
|
|
95
|
-
"@types/react": "^
|
|
96
|
-
"@types/react-dom": "^
|
|
94
|
+
"@types/node": "^26.1.2",
|
|
95
|
+
"@types/react": "^19.2.18",
|
|
96
|
+
"@types/react-dom": "^19.2.4",
|
|
97
97
|
"@vitest/coverage-v8": "^3.2.4",
|
|
98
98
|
"eslint": "^9.39.1",
|
|
99
99
|
"eslint-config-prettier": "^10.1.8",
|
|
100
100
|
"eslint-plugin-react": "^7.37.5",
|
|
101
101
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
102
|
-
"globals": "^
|
|
102
|
+
"globals": "^17.9.0",
|
|
103
103
|
"jsdom": "^26.1.0",
|
|
104
104
|
"prettier": "^3.6.2",
|
|
105
|
-
"react": "^
|
|
106
|
-
"react-dom": "^
|
|
105
|
+
"react": "^19.2.8",
|
|
106
|
+
"react-dom": "^19.2.8",
|
|
107
107
|
"tsup": "^8.5.0",
|
|
108
108
|
"typescript": "~5.9.3",
|
|
109
109
|
"typescript-eslint": "^8.46.4",
|