@caltho/site-kit 0.2.2 → 0.2.3

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.
@@ -119,6 +119,10 @@ export function SitePreview({ origins, render }) {
119
119
  hovered = null;
120
120
  outline("section", null);
121
121
  outline("hover", null);
122
+ // Another page starts at its top, unless a section on it is to be brought into view.
123
+ if (shown.path !== drawnPath && !(el && shown.scroll))
124
+ window.scrollTo({ top: 0 });
125
+ drawnPath = shown.path;
122
126
  // Scrolled here only: scrollIntoView would scroll CalOS's page around the frame too.
123
127
  if (el && shown.scroll)
124
128
  window.scrollTo({ top: el.getBoundingClientRect().top + window.scrollY - window.innerHeight / 4, behavior: "smooth" });
@@ -265,6 +269,8 @@ const looks = {
265
269
  hover: { outline: `1px dashed ${BLUE}`, outlineOffset: "3px", borderRadius: "3px" },
266
270
  };
267
271
  let hovered = null;
272
+ /** The page last drawn, so another one starts at its top. */
273
+ let drawnPath = null;
268
274
  const boxes = {};
269
275
  function outline(which, el, label) {
270
276
  let made = boxes[which];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caltho/site-kit",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "What every Caltho site is built with: the contract with CalOS (content, and how a site declares what is editable), images, search and security, and the checks",
5
5
  "license": "MIT",
6
6
  "type": "module",