foss-design 0.4.2 → 0.5.0
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/README.md +1 -1
- package/dist/cli.js +2883 -2371
- package/dist/runtime/index.js +33 -6
- package/dist/viewer/assets/{index-k3bj-XTr.js → index-D6sHcSw6.js} +48 -48
- package/dist/viewer/index.html +1 -1
- package/dist/viewer-lib/index.js +98 -13
- package/dist/viewer-lib/types/src/shared/routes.d.ts +37 -0
- package/dist/viewer-lib/types/src/shared/types.d.ts +6 -0
- package/dist/viewer-lib/types/viewer/src/lib/frames.d.ts +6 -4
- package/package.json +1 -1
package/dist/runtime/index.js
CHANGED
|
@@ -594,8 +594,9 @@ function useTheme() {
|
|
|
594
594
|
);
|
|
595
595
|
}
|
|
596
596
|
function go(target) {
|
|
597
|
-
|
|
598
|
-
|
|
597
|
+
const message = `go("${target}") is no longer supported: link to the screen instead (<a href="/\u2026">, or history.pushState in code) and give it a "route" in canvas.json`;
|
|
598
|
+
recordError(message);
|
|
599
|
+
throw new Error(message);
|
|
599
600
|
}
|
|
600
601
|
function useScreen() {
|
|
601
602
|
return { canvas: config.canvas, id: config.id, props: config.props };
|
|
@@ -701,11 +702,13 @@ async function takeSnapshot() {
|
|
|
701
702
|
}
|
|
702
703
|
}
|
|
703
704
|
function keepLinksInFrame() {
|
|
704
|
-
const report = (target, form) => post({
|
|
705
|
+
const report = (target, form, raw, pushed = false) => post({
|
|
705
706
|
type: "link",
|
|
706
707
|
href: target.href,
|
|
707
708
|
path: target.origin === location.origin ? target.pathname + target.search + target.hash : null,
|
|
708
|
-
form
|
|
709
|
+
form,
|
|
710
|
+
raw,
|
|
711
|
+
pushed
|
|
709
712
|
});
|
|
710
713
|
const onClick = (event) => {
|
|
711
714
|
if (event.defaultPrevented || event.button > 1) return;
|
|
@@ -716,7 +719,7 @@ function keepLinksInFrame() {
|
|
|
716
719
|
const samePage = target.origin === location.origin && target.pathname === location.pathname && target.search === location.search;
|
|
717
720
|
if (samePage && target.hash) return;
|
|
718
721
|
event.preventDefault();
|
|
719
|
-
report(target, false);
|
|
722
|
+
report(target, false, link.getAttribute("href") ?? "");
|
|
720
723
|
};
|
|
721
724
|
window.addEventListener("click", onClick);
|
|
722
725
|
window.addEventListener("auxclick", onClick);
|
|
@@ -724,8 +727,32 @@ function keepLinksInFrame() {
|
|
|
724
727
|
const form = event.target;
|
|
725
728
|
if (event.defaultPrevented || form.method === "dialog") return;
|
|
726
729
|
event.preventDefault();
|
|
727
|
-
|
|
730
|
+
const action = form.getAttribute("action") ?? "";
|
|
731
|
+
report(new URL(action || location.href, location.href), true, action);
|
|
728
732
|
});
|
|
733
|
+
const navigation = window.navigation;
|
|
734
|
+
navigation?.addEventListener("navigate", (event) => {
|
|
735
|
+
const nav = event;
|
|
736
|
+
if (!nav.cancelable || nav.destination.sameDocument || nav.downloadRequest !== null) return;
|
|
737
|
+
if (nav.navigationType === "reload") return;
|
|
738
|
+
const target = new URL(nav.destination.url);
|
|
739
|
+
if (target.pathname === location.pathname && target.search === location.search) return;
|
|
740
|
+
event.preventDefault();
|
|
741
|
+
report(
|
|
742
|
+
target,
|
|
743
|
+
false,
|
|
744
|
+
target.origin === location.origin ? target.pathname + target.search + target.hash : target.href
|
|
745
|
+
);
|
|
746
|
+
});
|
|
747
|
+
for (const name of ["pushState", "replaceState"]) {
|
|
748
|
+
const original = history[name].bind(history);
|
|
749
|
+
history[name] = (data, unused, url) => {
|
|
750
|
+
original(data, unused, url);
|
|
751
|
+
if (url === void 0 || url === null) return;
|
|
752
|
+
const raw = String(url);
|
|
753
|
+
report(new URL(raw, location.href), false, raw, true);
|
|
754
|
+
};
|
|
755
|
+
}
|
|
729
756
|
}
|
|
730
757
|
var booted = false;
|
|
731
758
|
var hmrBound = false;
|