Skip to content

Commit

Permalink
plantuml: Update to 1.2021.5
Browse files Browse the repository at this point in the history
  • Loading branch information
judaew authored and reneeotten committed May 4, 2021
1 parent 6d76584 commit bf3cc37
Show file tree
Hide file tree
Showing 2 changed files with 144 additions and 4 deletions.
12 changes: 8 additions & 4 deletions java/plantuml/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ PortSystem 1.0
PortGroup github 1.0
PortGroup java 1.0

github.setup plantuml plantuml 1.2021.4 v
github.setup plantuml plantuml 1.2021.5 v
revision 0
categories java editors
platforms darwin
Expand All @@ -16,9 +16,9 @@ description PlantUML is a tool for generating UML diagrams from text
long_description ${description}
homepage http://plantuml.com/

checksums rmd160 4873eae0a3f2749f0d7d9a05de22de01302dbf43 \
sha256 6609430326545746aaf1b65a991bfe89155967002447d6113762e106e1671cdd \
size 4678738
checksums rmd160 37c4b094dd2c4add672e683a3773c6d109081489 \
sha256 95348ce62e32d50539f81603b9424ee7f82ddfd93c8ec8607150774a01f26c1f \
size 4704854

depends_build bin:ant:apache-ant

Expand All @@ -37,6 +37,10 @@ post-extract {
copy ${filespath}/${name}.in ${worksrcpath}/${name}
}

# Change is already in master, remove the patch in next version
# See https://github.com/plantuml/plantuml/issues/545
patchfiles patch-add-missing-svg-folder.diff

post-patch {
reinplace "s|__PLANTUML_LAUNCHER_PATH__|${prefix}/share/java/${jarname}|g" \
${worksrcpath}/${name}
Expand Down
136 changes: 136 additions & 0 deletions java/plantuml/files/patch-add-missing-svg-folder.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
From: Arnaud Roques <plantuml@gmail.com>
Date: Sun, 2 May 2021 12:12:46 +0200
Subject: [PATCH] Add missing SVG folder

---
svg/default.css | 3 ++
svg/default.js | 110 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 113 insertions(+)
create mode 100644 svg/default.css
create mode 100644 svg/default.js

diff --git svg/default.css.orig svg/default.css
new file mode 100644
--- /dev/null
+++ svg/default.css
@@ -0,0 +1,3 @@
+.elem {cursor: pointer;}
+.elem, .link {opacity: 0.3;}
+.elem.selected, .link.selected {opacity: 1;}
\ No newline at end of file

diff --git svg/default.js.orig svg/default.js
new file mode 100644
--- /dev/null
+++ svg/default.js
@@ -0,0 +1,110 @@
+function addItemToMapOfLists(mapOfLists, name, item) {
+ // mapOfLists = {
+ // 'key1': [item1, item2, ...],
+ // 'key2': [item3, item4, ...],
+ // }
+ if (mapOfLists[name].length > 0) {
+ if (!mapOfLists[name].includes(item)) {
+ mapOfLists[name].push(item);
+ }
+ } else {
+ mapOfLists[name] = [item];
+ }
+}
+
+function main() {
+ let elems = Array.from(document.getElementsByClassName('elem'));
+ let links = Array.from(document.getElementsByClassName('link'));
+
+ let elemsMap = {};
+ let linkedElems = {};
+ let linkedLinks = {};
+
+ elems.forEach(elem => {
+ let name = elem.classList[1];
+ elemsMap[name] = elem;
+ linkedElems[name] = [];
+ linkedLinks[name] = [];
+ });
+
+ links.forEach(link => {
+ let name1 = link.classList[1];
+ let name2 = link.classList[2];
+
+ if (elemsMap[name1]) {
+ if (elemsMap[name2]) {
+ let elem1 = elemsMap[name1];
+ let elem2 = elemsMap[name2];
+
+ addItemToMapOfLists(linkedElems, name1, elem2);
+ addItemToMapOfLists(linkedElems, name2, elem1);
+
+ addItemToMapOfLists(linkedLinks, name1, link);
+ addItemToMapOfLists(linkedLinks, name2, link);
+ }
+ }
+ });
+
+ let selectedElems = [];
+ let selectedLinks = [];
+ let selectedElemName = null;
+
+ function clearSelected() {
+ selectedElems.forEach(item => {
+ item.classList.remove('selected');
+ });
+ selectedElems = [];
+
+ selectedLinks.forEach(item => {
+ item.classList.remove('selected');
+ });
+ selectedLinks = [];
+ }
+
+ function selectAll() {
+ selectedElemName = null;
+
+ selectedElems = Array.from(elems);
+ selectedElems.forEach(item => {
+ item.classList.add('selected');
+ });
+
+ selectedLinks = Array.from(links);
+ selectedLinks.forEach(item => {
+ item.classList.add('selected');
+ });
+ }
+
+ function selectElem(elemName) {
+ if (elemName === selectedElemName) {
+ selectAll();
+
+ } else {
+ clearSelected();
+ selectedElemName = elemName;
+
+ elemsMap[elemName].classList.add('selected');
+ selectedElems.push(elemsMap[elemName]);
+
+ linkedElems[elemName].forEach(linkedElem => {
+ selectedElems.push(linkedElem);
+ linkedElem.classList.add('selected');
+ });
+
+ linkedLinks[elemName].forEach(linkedLink => {
+ selectedLinks.push(linkedLink);
+ linkedLink.classList.add('selected');
+ });
+ }
+ }
+
+ Object.keys(elemsMap).forEach(name => {
+ elemsMap[name].onclick = () => { selectElem(name); };
+ });
+
+ selectAll();
+}
+
+document.addEventListener('DOMContentLoaded', (event) => {
+ main();
+});

0 comments on commit bf3cc37

Please sign in to comment.