foss-design 0.9.3 → 0.9.4
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/viewer/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
document.documentElement.dataset.theme = dark ? 'dark' : 'light'
|
|
15
15
|
} catch (e) {}
|
|
16
16
|
</script>
|
|
17
|
-
<script type="module" crossorigin src="./assets/index-
|
|
17
|
+
<script type="module" crossorigin src="./assets/index-CTraVnJV.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="./assets/index-DCfxIE2h.css">
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
package/dist/viewer-lib/index.js
CHANGED
|
@@ -7807,6 +7807,31 @@ function sendToFrame(frame, message) {
|
|
|
7807
7807
|
function claimWheel(frame) {
|
|
7808
7808
|
sendToFrame(frame, { type: "canvas" });
|
|
7809
7809
|
}
|
|
7810
|
+
/**
|
|
7811
|
+
* A wheel the frame had no use for (it reached its edge, or holds nothing that scrolls): scroll
|
|
7812
|
+
* whatever scrolls around the frame, as the browser would if the frame's edges passed it on.
|
|
7813
|
+
*/
|
|
7814
|
+
function scrollAround(frame, delta) {
|
|
7815
|
+
for (let node = frame.parentElement; node; node = node.parentElement) {
|
|
7816
|
+
const style = getComputedStyle(node);
|
|
7817
|
+
const scrolls = (overflow) => /(auto|scroll|overlay)/.test(overflow);
|
|
7818
|
+
const y = scrolls(style.overflowY) && node.scrollHeight > node.clientHeight;
|
|
7819
|
+
const x = scrolls(style.overflowX) && node.scrollWidth > node.clientWidth;
|
|
7820
|
+
if (y || x) {
|
|
7821
|
+
node.scrollBy({
|
|
7822
|
+
left: x ? delta.deltaX : 0,
|
|
7823
|
+
top: y ? delta.deltaY : 0,
|
|
7824
|
+
behavior: "instant"
|
|
7825
|
+
});
|
|
7826
|
+
return;
|
|
7827
|
+
}
|
|
7828
|
+
}
|
|
7829
|
+
window.scrollBy({
|
|
7830
|
+
left: delta.deltaX,
|
|
7831
|
+
top: delta.deltaY,
|
|
7832
|
+
behavior: "instant"
|
|
7833
|
+
});
|
|
7834
|
+
}
|
|
7810
7835
|
function sendTheme(frame, theme) {
|
|
7811
7836
|
sendToFrame(frame, {
|
|
7812
7837
|
type: "theme",
|
|
@@ -14223,6 +14248,7 @@ function AutoFrame({ src, theme, title, minHeight = 120, width, className }) {
|
|
|
14223
14248
|
else if (message.type === "ready") setReady(true);
|
|
14224
14249
|
else if (message.type === "error") setErrors((list) => list.includes(message.message) ? list : [...list, message.message]);
|
|
14225
14250
|
else if (message.type === "updated") setErrors([]);
|
|
14251
|
+
else if (message.type === "wheel" && !message.zoom) scrollAround(frame, message);
|
|
14226
14252
|
});
|
|
14227
14253
|
}, [minHeight, url]);
|
|
14228
14254
|
useEffect(() => {
|
|
@@ -7,6 +7,14 @@ type Outgoing = ViewerMessage extends infer M ? M extends {
|
|
|
7
7
|
export declare function sendToFrame(frame: HTMLIFrameElement | null, message: Outgoing): void;
|
|
8
8
|
/** Tell a frame it sits on the canvas, so it hands the wheel to the viewer. */
|
|
9
9
|
export declare function claimWheel(frame: HTMLIFrameElement | null): void;
|
|
10
|
+
/**
|
|
11
|
+
* A wheel the frame had no use for (it reached its edge, or holds nothing that scrolls): scroll
|
|
12
|
+
* whatever scrolls around the frame, as the browser would if the frame's edges passed it on.
|
|
13
|
+
*/
|
|
14
|
+
export declare function scrollAround(frame: HTMLIFrameElement, delta: {
|
|
15
|
+
deltaX: number;
|
|
16
|
+
deltaY: number;
|
|
17
|
+
}): void;
|
|
10
18
|
export declare function sendTheme(frame: HTMLIFrameElement | null, theme: Theme): void;
|
|
11
19
|
/** Load the frame again; works whatever origin it is on. */
|
|
12
20
|
export declare function reloadFrame(frame: HTMLIFrameElement | null): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foss-design",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Design canvases and design systems for coding agents: live, animated, clickable screens on an infinite canvas, served locally from a .design folder.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|