Bump dompurify and jspdf in /web (#777)

* Bump dompurify and jspdf in /web

Bumps [dompurify](https://github.com/cure53/DOMPurify) to 3.3.1 and updates ancestor dependency [jspdf](https://github.com/parallax/jsPDF). These dependencies need to be updated together.


Updates `dompurify` from 2.5.8 to 3.3.1
- [Release notes](https://github.com/cure53/DOMPurify/releases)
- [Commits](https://github.com/cure53/DOMPurify/compare/2.5.8...3.3.1)

Updates `jspdf` from 2.5.2 to 4.1.0
- [Release notes](https://github.com/parallax/jsPDF/releases)
- [Changelog](https://github.com/parallax/jsPDF/blob/master/RELEASE.md)
- [Commits](https://github.com/parallax/jsPDF/compare/v2.5.2...v4.1.0)

---
updated-dependencies:
- dependency-name: dompurify
  dependency-version: 3.3.1
  dependency-type: indirect
- dependency-name: jspdf
  dependency-version: 4.1.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixes waypoint marker icon positions

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christian Beutel <>
This commit is contained in:
dependabot[bot]
2026-02-06 12:40:42 +01:00
committed by GitHub
parent d1c87577de
commit f877e0b266
3 changed files with 127 additions and 74 deletions

88
web/package-lock.json generated
View File

@@ -42,7 +42,7 @@
"instead": "^1.0.3", "instead": "^1.0.3",
"isomorphic-xml2js": "^0.1.3", "isomorphic-xml2js": "^0.1.3",
"json-diff-ts": "^4.8.1", "json-diff-ts": "^4.8.1",
"jspdf": "^2.5.1", "jspdf": "^4.1.0",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"maplibre-gl": "^4.7.1", "maplibre-gl": "^4.7.1",
"marked": "^16.2.0", "marked": "^16.2.0",
@@ -2188,6 +2188,12 @@
"undici-types": "~6.19.2" "undici-types": "~6.19.2"
} }
}, },
"node_modules/@types/pako": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/pako/-/pako-2.0.4.tgz",
"integrity": "sha512-VWDCbrLeVXJM9fihYodcLiIv0ku+AlOa/TQ1SvYOaBuyrSKgEcro95LJyIsJ4vSo6BXIxOKxiJAat04CmST9Fw==",
"license": "MIT"
},
"node_modules/@types/pbf": { "node_modules/@types/pbf": {
"version": "3.0.5", "version": "3.0.5",
"resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/pbf/-/pbf-3.0.5.tgz",
@@ -2233,6 +2239,13 @@
"meshoptimizer": "~0.18.1" "meshoptimizer": "~0.18.1"
} }
}, },
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
"integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==",
"license": "MIT",
"optional": true
},
"node_modules/@types/webxr": { "node_modules/@types/webxr": {
"version": "0.5.21", "version": "0.5.21",
"resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.21.tgz", "resolved": "https://registry.npmjs.org/@types/webxr/-/webxr-0.5.21.tgz",
@@ -2432,18 +2445,6 @@
"node": "*" "node": "*"
} }
}, },
"node_modules/atob": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"license": "(MIT OR Apache-2.0)",
"bin": {
"atob": "bin/atob.js"
},
"engines": {
"node": ">= 4.5.0"
}
},
"node_modules/autoprefixer": { "node_modules/autoprefixer": {
"version": "10.4.20", "version": "10.4.20",
"resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz",
@@ -2600,18 +2601,6 @@
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
} }
}, },
"node_modules/btoa": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/btoa/-/btoa-1.2.1.tgz",
"integrity": "sha512-SB4/MIGlsiVkMcHmT+pSmIPoNDoHg+7cMzmt3Uxt628MTz2487DKSqK/fuhFBrkuqrYv5UCEnACpF4dTFNKc/g==",
"license": "(MIT OR Apache-2.0)",
"bin": {
"btoa": "bin/btoa.js"
},
"engines": {
"node": ">= 0.4.0"
}
},
"node_modules/cac": { "node_modules/cac": {
"version": "6.7.14", "version": "6.7.14",
"resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
@@ -3191,11 +3180,14 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/dompurify": { "node_modules/dompurify": {
"version": "2.5.8", "version": "3.3.1",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-2.5.8.tgz", "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.3.1.tgz",
"integrity": "sha512-o1vSNgrmYMQObbSSvF/1brBYEQPHhV1+gsmrusO7/GXtp1T9rCS8cXFqVxK/9crT1jA6Ccv+5MTSjBNqr7Sovw==", "integrity": "sha512-qkdCKzLNtrgPFP1Vo+98FRzJnBRGe4ffyCea9IwHB1fyxPOeNTHpLKYGd4Uk9xvNoH0ZoOjwZxNptyMwqrId1Q==",
"license": "(MPL-2.0 OR Apache-2.0)", "license": "(MPL-2.0 OR Apache-2.0)",
"optional": true "optional": true,
"optionalDependencies": {
"@types/trusted-types": "^2.0.7"
}
}, },
"node_modules/dunder-proto": { "node_modules/dunder-proto": {
"version": "1.0.1", "version": "1.0.1",
@@ -3505,6 +3497,23 @@
"type": "^2.7.2" "type": "^2.7.2"
} }
}, },
"node_modules/fast-png": {
"version": "6.4.0",
"resolved": "https://registry.npmjs.org/fast-png/-/fast-png-6.4.0.tgz",
"integrity": "sha512-kAqZq1TlgBjZcLr5mcN6NP5Rv4V2f22z00c3g8vRrwkcqjerx7BEhPbOnWCPqaHUl2XWQBJQvOT/FQhdMT7X/Q==",
"license": "MIT",
"dependencies": {
"@types/pako": "^2.0.3",
"iobuffer": "^5.3.2",
"pako": "^2.1.0"
}
},
"node_modules/fast-png/node_modules/pako": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz",
"integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==",
"license": "(MIT AND Zlib)"
},
"node_modules/fdir": { "node_modules/fdir": {
"version": "6.4.3", "version": "6.4.3",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz",
@@ -3972,6 +3981,12 @@
"tslib": "2" "tslib": "2"
} }
}, },
"node_modules/iobuffer": {
"version": "5.4.0",
"resolved": "https://registry.npmjs.org/iobuffer/-/iobuffer-5.4.0.tgz",
"integrity": "sha512-DRebOWuqDvxunfkNJAlc3IzWIPD5xVxwUNbHr7xKB8E6aLJxIPfNX3CoMJghcFjpv6RWQsrcJbghtEwSPoJqMA==",
"license": "MIT"
},
"node_modules/is-arguments": { "node_modules/is-arguments": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.2.0.tgz",
@@ -4314,20 +4329,19 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/jspdf": { "node_modules/jspdf": {
"version": "2.5.2", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/jspdf/-/jspdf-2.5.2.tgz", "resolved": "https://registry.npmjs.org/jspdf/-/jspdf-4.1.0.tgz",
"integrity": "sha512-myeX9c+p7znDWPk0eTrujCzNjT+CXdXyk7YmJq5nD5V7uLLKmSXnlQ/Jn/kuo3X09Op70Apm0rQSnFWyGK8uEQ==", "integrity": "sha512-xd1d/XRkwqnsq6FP3zH1Q+Ejqn2ULIJeDZ+FTKpaabVpZREjsJKRJwuokTNgdqOU+fl55KgbvgZ1pRTSWCP2kQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.23.2", "@babel/runtime": "^7.28.4",
"atob": "^2.1.2", "fast-png": "^6.2.0",
"btoa": "^1.2.1",
"fflate": "^0.8.1" "fflate": "^0.8.1"
}, },
"optionalDependencies": { "optionalDependencies": {
"canvg": "^3.0.6", "canvg": "^3.0.11",
"core-js": "^3.6.0", "core-js": "^3.6.0",
"dompurify": "^2.5.4", "dompurify": "^3.3.1",
"html2canvas": "^1.0.0-rc.5" "html2canvas": "^1.0.0-rc.5"
} }
}, },

View File

@@ -63,7 +63,7 @@
"instead": "^1.0.3", "instead": "^1.0.3",
"isomorphic-xml2js": "^0.1.3", "isomorphic-xml2js": "^0.1.3",
"json-diff-ts": "^4.8.1", "json-diff-ts": "^4.8.1",
"jspdf": "^2.5.1", "jspdf": "^4.1.0",
"jszip": "^3.10.1", "jszip": "^3.10.1",
"maplibre-gl": "^4.7.1", "maplibre-gl": "^4.7.1",
"marked": "^16.2.0", "marked": "^16.2.0",

View File

@@ -94,14 +94,15 @@
}); });
function faUnicode(name: string) { function faUnicode(name: string) {
var testI = document.createElement('i'); var testI = document.createElement("i");
var char; var char;
testI.className = 'fa fa-' + name; testI.className = "fa fa-" + name;
document.body.appendChild(testI); document.body.appendChild(testI);
char = window.getComputedStyle( testI, ':before' ) char = window
.content.replace(/'|"/g, ''); .getComputedStyle(testI, ":before")
.content.replace(/'|"/g, "");
testI.remove(); testI.remove();
@@ -111,10 +112,11 @@
function getTextHeight(text: string, doc: jsPDF, width: number) { function getTextHeight(text: string, doc: jsPDF, width: number) {
let numLines = doc.splitTextToSize(text, width).length; let numLines = doc.splitTextToSize(text, width).length;
return (numLines * doc.getFontSize() * doc.getLineHeightFactor() - return (
(numLines * doc.getFontSize() * doc.getLineHeightFactor() -
doc.getFontSize() * (doc.getLineHeightFactor() - 1)) / doc.getFontSize() * (doc.getLineHeightFactor() - 1)) /
doc.internal.scaleFactor; doc.internal.scaleFactor
);
} }
async function print() { async function print() {
@@ -203,7 +205,7 @@
doc.text( doc.text(
iconText, iconText,
iconPositionX + circleRadius - letterWidth / 2, iconPositionX + 2 * circleRadius - letterWidth / 2 - 0.3,
iconPositionY + circleRadius + letterHeight / 2 - 0.33, iconPositionY + circleRadius + letterHeight / 2 - 0.33,
); );
} }
@@ -380,19 +382,29 @@
} }
if (includeDescription && $trail.description) { if (includeDescription && $trail.description) {
let textHeight = getTextHeight($trail.description, doc, width - 32) let textHeight = getTextHeight(
$trail.description,
doc,
width - 32,
);
if (currentHeight + textHeight + 8 > height) { if (currentHeight + textHeight + 8 > height) {
newPage(); newPage();
} }
doc.text(formatHTMLAsText($trail.description), 16, currentHeight, { doc.text(
maxWidth: width - 32, formatHTMLAsText($trail.description),
}); 16,
currentHeight += getTextHeight($trail.description, doc, width - 32) + 8; currentHeight,
{
maxWidth: width - 32,
},
);
currentHeight +=
getTextHeight($trail.description, doc, width - 32) + 8;
} }
if (includeWaypoints && $trail.expand?.waypoints_via_trail) { if (includeWaypoints && $trail.expand?.waypoints_via_trail) {
const header = $_("waypoints", { values: { n: 2 } }) const header = $_("waypoints", { values: { n: 2 } });
let textHeight = getTextHeight(header, doc, width - 32) let textHeight = getTextHeight(header, doc, width - 32);
if (currentHeight + textHeight + 8 > height) { if (currentHeight + textHeight + 8 > height) {
newPage(); newPage();
} }
@@ -400,30 +412,58 @@
doc.text(header, 16, currentHeight); doc.text(header, 16, currentHeight);
currentHeight += textHeight + 8; currentHeight += textHeight + 8;
($trail.expand.waypoints_via_trail || []).forEach(waypoint => { ($trail.expand.waypoints_via_trail || []).forEach(
let description = waypoint.description || ""; (waypoint) => {
let name = waypoint.name || ""; let description = waypoint.description || "";
let name = waypoint.name || "";
let textHeight = getTextHeight(`${name ? name + "\n" : ""}${description}`, doc, width - 32 - 8) + (name ? 2 : 0); let textHeight =
if (currentHeight + textHeight + 16 > height) { getTextHeight(
newPage(); `${name ? name + "\n" : ""}${description}`,
} doc,
width - 32 - 8,
) + (name ? 2 : 0);
if (currentHeight + textHeight + 16 > height) {
newPage();
}
doc.setFont("fa-solid-900", "normal"); doc.setFont("fa-solid-900", "normal");
doc.text(String.fromCharCode(faUnicode(waypoint.icon || "circle")), 16, currentHeight); doc.text(
String.fromCharCode(
faUnicode(waypoint.icon || "circle"),
),
16,
currentHeight,
);
if (name) { if (name) {
doc.setFont("IBMPlexSans-SemiBold", "bold"); doc.setFont("IBMPlexSans-SemiBold", "bold");
doc.text(formatHTMLAsText(name), 24, currentHeight); doc.text(formatHTMLAsText(name), 24, currentHeight);
currentHeight += getTextHeight(formatHTMLAsText(name), doc, width - 32) + 2; currentHeight +=
} getTextHeight(
formatHTMLAsText(name),
doc,
width - 32,
) + 2;
}
doc.setFont("IBMPlexSans-Regular", "normal"); doc.setFont("IBMPlexSans-Regular", "normal");
doc.text(formatHTMLAsText(description), 24, currentHeight, { doc.text(
maxWidth: width - 32 - 8 formatHTMLAsText(description),
}); 24,
currentHeight += getTextHeight(formatHTMLAsText(description), doc, width - 32 - 8) + 8; currentHeight,
}); {
maxWidth: width - 32 - 8,
},
);
currentHeight +=
getTextHeight(
formatHTMLAsText(description),
doc,
width - 32 - 8,
) + 8;
},
);
} }
addLogo(); addLogo();
@@ -533,7 +573,6 @@
showGrid = true; showGrid = true;
} }
} }
</script> </script>
<svelte:head> <svelte:head>