@cfbender/cesium 0.7.2 → 0.7.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cfbender/cesium",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "Beautiful self-contained HTML artifacts from your opencode agent.",
5
5
  "keywords": [
6
6
  "agent",
@@ -896,12 +896,21 @@ export function getClientJs(): string {
896
896
 
897
897
  menu.hidden = false;
898
898
  var menuRect = menu.getBoundingClientRect();
899
- var top = rect.bottom + window.scrollY + 6;
900
- var left = rect.right + window.scrollX - menuRect.width;
899
+ // The menu uses position: fixed, so coordinates are viewport-relative —
900
+ // do NOT add window.scrollX/scrollY here, or the menu gets parked at
901
+ // (rect + scrollY) which is off-screen as soon as the user scrolls.
902
+ var top = rect.bottom + 6;
903
+ var left = rect.right - menuRect.width;
901
904
  // Clamp to viewport
902
905
  var vpW = window.innerWidth || document.documentElement.clientWidth;
906
+ var vpH = window.innerHeight || document.documentElement.clientHeight;
903
907
  if (left + menuRect.width > vpW - 8) left = vpW - menuRect.width - 8;
904
908
  if (left < 8) left = 8;
909
+ // If the menu would fall below the viewport, flip above the selection.
910
+ if (top + menuRect.height > vpH - 8) {
911
+ top = rect.top - menuRect.height - 6;
912
+ }
913
+ if (top < 8) top = 8;
905
914
  menu.style.top = top + "px";
906
915
  menu.style.left = left + "px";
907
916
 
@@ -1134,14 +1134,24 @@ body { position: relative; }
1134
1134
  z-index: 50;
1135
1135
  }
1136
1136
  /* When annotate is active and viewport has room for page + rail side-by-side,
1137
- shift .page leftward so its right edge (and the .cs-anchor-affordance-block
1138
- button parked at right: 8px of each annotatable block) does not slide under
1139
- the rail. Required viewport width: 1120 (page) + 24 (gap) + 280 (rail) +
1140
- 24 (right gutter) = 1448px. */
1137
+ shift the content area leftward so its right edge (and the
1138
+ .cs-anchor-affordance-block button parked at right: 8px of each annotatable
1139
+ block) does not slide under the rail.
1140
+
1141
+ Artifacts have no .page wrapper — content sits directly in <body>. So we
1142
+ shrink the body content via padding-right. The legacy .page rule remains so
1143
+ the same shift works on index pages.
1144
+
1145
+ Required viewport width: 1120 (page) + 24 (gap) + 280 (rail) + 24 (right
1146
+ gutter) = 1448px. */
1141
1147
  @media (min-width: 1448px) {
1148
+ body.cs-annotate-active,
1149
+ body:has(.cs-annotate-scaffold) {
1150
+ padding-right: 328px; /* rail width (280) + outer gutter (24) + inner gap (24) */
1151
+ }
1142
1152
  body.cs-annotate-active .page,
1143
1153
  body:has(.cs-annotate-scaffold) .page {
1144
- margin-right: 328px; /* rail width (280) + outer gutter (24) + inner gap (24) */
1154
+ margin-right: 0;
1145
1155
  margin-left: auto;
1146
1156
  }
1147
1157
  }