foss-design 0.3.4 → 0.3.6
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/dist/runtime/index.js +28 -0
- package/dist/viewer/assets/{index-CKTebSHE.js → index-DmtHtusH.js} +47 -47
- package/dist/viewer/assets/index-YT1s8WdL.css +2 -0
- package/dist/viewer/index.html +2 -2
- package/dist/viewer-lib/index.js +42 -4
- package/dist/viewer-lib/styles.css +4 -0
- package/dist/viewer-lib/types/src/shared/types.d.ts +12 -0
- package/dist/viewer-lib/types/viewer/src/lib/frames.d.ts +9 -1
- package/dist/viewer-lib/types/viewer/src/pages/canvas/items.d.ts +4 -1
- package/dist/viewer-lib/types/viewer/src/ui/toast.d.ts +1 -1
- package/package.json +1 -1
- package/dist/viewer/assets/index-DoXrvm22.css +0 -2
package/dist/runtime/index.js
CHANGED
|
@@ -700,6 +700,33 @@ async function takeSnapshot() {
|
|
|
700
700
|
} catch {
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
|
+
function keepLinksInFrame() {
|
|
704
|
+
const report = (target, form) => post({
|
|
705
|
+
type: "link",
|
|
706
|
+
href: target.href,
|
|
707
|
+
path: target.origin === location.origin ? target.pathname + target.search + target.hash : null,
|
|
708
|
+
form
|
|
709
|
+
});
|
|
710
|
+
const onClick = (event) => {
|
|
711
|
+
if (event.defaultPrevented || event.button > 1) return;
|
|
712
|
+
const link = event.target?.closest?.("a[href], area[href]");
|
|
713
|
+
if (!link || link.hasAttribute("download")) return;
|
|
714
|
+
const target = new URL(link.href, location.href);
|
|
715
|
+
if (target.protocol !== "http:" && target.protocol !== "https:") return;
|
|
716
|
+
const samePage = target.origin === location.origin && target.pathname === location.pathname && target.search === location.search;
|
|
717
|
+
if (samePage && target.hash) return;
|
|
718
|
+
event.preventDefault();
|
|
719
|
+
report(target, false);
|
|
720
|
+
};
|
|
721
|
+
window.addEventListener("click", onClick);
|
|
722
|
+
window.addEventListener("auxclick", onClick);
|
|
723
|
+
window.addEventListener("submit", (event) => {
|
|
724
|
+
const form = event.target;
|
|
725
|
+
if (event.defaultPrevented || form.method === "dialog") return;
|
|
726
|
+
event.preventDefault();
|
|
727
|
+
report(new URL(form.getAttribute("action") || location.href, location.href), true);
|
|
728
|
+
});
|
|
729
|
+
}
|
|
703
730
|
var booted = false;
|
|
704
731
|
var hmrBound = false;
|
|
705
732
|
var canvasHost = false;
|
|
@@ -759,6 +786,7 @@ function boot() {
|
|
|
759
786
|
},
|
|
760
787
|
true
|
|
761
788
|
);
|
|
789
|
+
if (embedded) keepLinksInFrame();
|
|
762
790
|
window.addEventListener("blur", () => post({ type: "blur" }));
|
|
763
791
|
window.addEventListener("error", (event) => recordError(event.message || "Script error"));
|
|
764
792
|
window.addEventListener("unhandledrejection", (event) => {
|