uml-viewer 0.1.1 → 0.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +2 -1
- data/lib/uml/viewer/version.rb +1 -1
- data/lib/uml/viewer/web/app.js +53 -2
- data/lib/uml/viewer/web/index.html +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: edf3b6511230eb485afff4b396525dd34aa46c4fb353dbcaaa8145c027a3cda9
|
|
4
|
+
data.tar.gz: fff20a6122fa1587a4a7c8d4d9704cd53b85415af0cc4ea10b5feb6e790a5cb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a4556a51d6b93556909c213210761864195f8a2075310a7a9480cab75aebf75d58e437f6a8aaf5279bd7614373c982210e627f0775990d4afa4655ebd585c3d4
|
|
7
|
+
data.tar.gz: 8272d30e0aa13abe0bbe39a93495dd47b0e5d19ef75b3ba1eb205632d8203e522dd22eda357a6beca2e991d7fef2b0ec41d4573653d191f1c7925b09c9c0f8ef
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,22 @@ All notable changes are documented here. The format is based on [Keep a Changelo
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.1.3] - 2026-11-01
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- A middle-button drag pans the diagram. The cursor shows a closed hand while you pan. The pan stays active when the browser releases the pointer outside the window.
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
- A single click on a class opens its card. Before, the card opened on a double-click. A double-click on a box still opens its view.
|
|
14
|
+
|
|
15
|
+
## [0.1.2] - 2026-10-23
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
- A box and a member name that open on a double-click show the hand cursor.
|
|
19
|
+
- A hovered box gets a border in the text color, and a hovered member name gets a light background behind its line, as in the original tool.
|
|
20
|
+
- A double-click beside a member name, on its line, also opens it.
|
|
21
|
+
- A click on empty space closes the source panel and the class card.
|
|
22
|
+
|
|
7
23
|
## [0.1.1] - 2026-10-23
|
|
8
24
|
|
|
9
25
|
### Changed
|
data/README.md
CHANGED
|
@@ -17,7 +17,8 @@ uml-viewer path/to/project
|
|
|
17
17
|
## Navigate
|
|
18
18
|
|
|
19
19
|
- Double-click a box to open it. Press `Esc` to go back.
|
|
20
|
-
-
|
|
20
|
+
- Click a class to open its card. Click an operation to see its source.
|
|
21
|
+
- Press `Esc` or click empty space to close the source panel and the class card.
|
|
21
22
|
- Hover an arrow to see the class pairs behind it.
|
|
22
23
|
- Right-click a box or a class to send **Explain** or **Omit** to Claude.
|
|
23
24
|
|
data/lib/uml/viewer/version.rb
CHANGED
data/lib/uml/viewer/web/app.js
CHANGED
|
@@ -157,6 +157,7 @@
|
|
|
157
157
|
lines.forEach((line, index) => {
|
|
158
158
|
const attrs = { x: 14, y: 36 + LINE * index, class: line.more ? "more" : "member" };
|
|
159
159
|
if (!line.more) Object.assign(attrs, { "data-id": line.id, "data-kind": line.kind });
|
|
160
|
+
if (!line.more) el("rect", { class: "wash", x: 6, y: attrs.y - 12, width: placed.width - 12, height: LINE, "data-id": line.id, "data-kind": line.kind }, group);
|
|
160
161
|
el("text", attrs, group).textContent = line.text;
|
|
161
162
|
});
|
|
162
163
|
};
|
|
@@ -441,10 +442,15 @@
|
|
|
441
442
|
}
|
|
442
443
|
|
|
443
444
|
function onDoubleClick(event) {
|
|
444
|
-
const member = event.target.closest("text.member");
|
|
445
|
+
const member = event.target.closest("text.member, rect.wash");
|
|
445
446
|
const box = event.target.closest("g.box");
|
|
446
447
|
if (member && BOXES.includes(member.dataset.kind)) return openView(member.dataset.id);
|
|
447
448
|
if (!member && box && BOXES.includes(box.dataset.type)) return openView(box.dataset.id);
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function onClick(event) {
|
|
452
|
+
const member = event.target.closest("text.member, rect.wash");
|
|
453
|
+
const box = event.target.closest("g.box");
|
|
448
454
|
if (member && member.dataset.kind === "class") return openCard(member.dataset.id);
|
|
449
455
|
if (!member && box && box.dataset.type === "class") return openCard(box.dataset.id);
|
|
450
456
|
}
|
|
@@ -457,8 +463,48 @@
|
|
|
457
463
|
});
|
|
458
464
|
addEventListener("scroll", saveSession);
|
|
459
465
|
|
|
466
|
+
const MIDDLE = 1;
|
|
467
|
+
const MIDDLE_HELD = 4;
|
|
468
|
+
let pan = null;
|
|
469
|
+
let swallowMiddleClick = false;
|
|
470
|
+
|
|
471
|
+
const endPan = () => {
|
|
472
|
+
if (!pan) return;
|
|
473
|
+
if (svg.hasPointerCapture(pan.pointer)) svg.releasePointerCapture(pan.pointer);
|
|
474
|
+
swallowMiddleClick = pan.moved;
|
|
475
|
+
pan = null;
|
|
476
|
+
document.documentElement.classList.remove("panning");
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
svg.addEventListener("pointerdown", (event) => {
|
|
480
|
+
if (event.button !== MIDDLE || pan) return;
|
|
481
|
+
event.preventDefault();
|
|
482
|
+
svg.setPointerCapture(event.pointerId);
|
|
483
|
+
pan = { pointer: event.pointerId, x: event.clientX, y: event.clientY, scrollX, scrollY, moved: false };
|
|
484
|
+
document.documentElement.classList.add("panning");
|
|
485
|
+
});
|
|
486
|
+
|
|
487
|
+
addEventListener("pointermove", (event) => {
|
|
488
|
+
if (!pan || event.pointerId !== pan.pointer) return;
|
|
489
|
+
if (!(event.buttons & MIDDLE_HELD)) return endPan();
|
|
490
|
+
if (!svg.hasPointerCapture(pan.pointer)) svg.setPointerCapture(pan.pointer);
|
|
491
|
+
pan.moved ||= event.clientX !== pan.x || event.clientY !== pan.y;
|
|
492
|
+
scrollTo(pan.scrollX + pan.x - event.clientX, pan.scrollY + pan.y - event.clientY);
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
addEventListener("pointerup", (event) => {
|
|
496
|
+
if (pan && event.pointerId === pan.pointer) endPan();
|
|
497
|
+
});
|
|
498
|
+
addEventListener("pointerdown", () => { swallowMiddleClick = false; }, true);
|
|
499
|
+
addEventListener("auxclick", (event) => {
|
|
500
|
+
if (!swallowMiddleClick || event.button !== MIDDLE) return;
|
|
501
|
+
swallowMiddleClick = false;
|
|
502
|
+
event.preventDefault();
|
|
503
|
+
event.stopPropagation();
|
|
504
|
+
}, true);
|
|
505
|
+
|
|
460
506
|
svg.addEventListener("contextmenu", (event) => {
|
|
461
|
-
const member = event.target.closest("text.member");
|
|
507
|
+
const member = event.target.closest("text.member, rect.wash");
|
|
462
508
|
const box = event.target.closest("g.box");
|
|
463
509
|
if (!member && (!box || box.dataset.type === "foreign")) return;
|
|
464
510
|
event.preventDefault();
|
|
@@ -500,6 +546,11 @@
|
|
|
500
546
|
declutterButton.addEventListener("click", cycleDeclutter);
|
|
501
547
|
|
|
502
548
|
document.addEventListener("click", (event) => { if (!menu.contains(event.target)) menu.classList.remove("open"); });
|
|
549
|
+
svg.addEventListener("click", (event) => {
|
|
550
|
+
if (event.target !== svg) return onClick(event);
|
|
551
|
+
document.getElementById("source").hidden = true;
|
|
552
|
+
document.getElementById("card").hidden = true;
|
|
553
|
+
});
|
|
503
554
|
|
|
504
555
|
const restore = (session) => {
|
|
505
556
|
if (Array.isArray(session.drill) && session.drill.length) drill = session.drill;
|
|
@@ -16,10 +16,15 @@
|
|
|
16
16
|
#banner { color: var(--red); }
|
|
17
17
|
#banner:empty { display: none; }
|
|
18
18
|
svg { position: absolute; top: 36px; left: 0; }
|
|
19
|
-
g.box rect, g.box ellipse { fill: var(--box); stroke: var(--line); }
|
|
19
|
+
g.box rect:not(.wash), g.box ellipse { fill: var(--box); stroke: var(--line); }
|
|
20
20
|
g.box.foreign ellipse { stroke-dasharray: 4 3; }
|
|
21
21
|
g.box.folder text.title { font-style: italic; }
|
|
22
22
|
g.box.component rect { stroke-width: 2; }
|
|
23
|
+
g.box:not(.foreign) { cursor: pointer; }
|
|
24
|
+
g.box:not(.foreign):hover > rect:not(.wash) { stroke: var(--fg); }
|
|
25
|
+
rect.wash { fill: transparent; }
|
|
26
|
+
rect.wash:hover { fill: var(--hl); }
|
|
27
|
+
text.member { pointer-events: none; }
|
|
23
28
|
text { fill: var(--fg); }
|
|
24
29
|
text.level, text.more { fill: var(--muted); }
|
|
25
30
|
path.arrow { fill: none; stroke: var(--line); stroke-width: 1.2; marker-end: url(#head); }
|
|
@@ -49,6 +54,7 @@
|
|
|
49
54
|
#popup .violating { color: var(--red); }
|
|
50
55
|
path.hit { fill: none; stroke: transparent; stroke-width: 10; }
|
|
51
56
|
circle.dot { stroke: var(--line); stroke-width: 0.5; }
|
|
57
|
+
html.panning, html.panning * { cursor: grabbing !important; }
|
|
52
58
|
</style>
|
|
53
59
|
</head>
|
|
54
60
|
<body>
|