@vinena/knobs 0.6.1 → 0.6.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # changelog
2
2
 
3
+ ## 0.6.2
4
+
5
+ - no 1px light line at the top or bottom edge of a phone screen in the device frame, at any pixel ratio: the screen is drawn a whole number of device pixels tall and starts on a whole device pixel, and it is redrawn when the pixel ratio changes. devices without a body, and set zooms like 100%, look as before
6
+
3
7
  ## 0.6.1
4
8
 
5
9
  - the `keep edits after reload` switch is in the settings now, with a short hint under it, and no longer at the top of the Elements view. as before, it is not there in fresh mode or in the copy of devknobs inside its own frame, which keeps nothing itself; the page's keeper still keeps edits made in the frame
@@ -98,7 +98,7 @@ import {
98
98
  import {
99
99
  getState,
100
100
  subscribe
101
- } from "./react-cs62p9qh.js";
101
+ } from "./react-myz2rvvn.js";
102
102
  import {
103
103
  isMac
104
104
  } from "./react-ttj8f9qp.js";
@@ -97,7 +97,7 @@ import {
97
97
  import {
98
98
  getState,
99
99
  subscribe
100
- } from "./index-x59vz1xx.js";
100
+ } from "./index-ggf32ddy.js";
101
101
  import {
102
102
  isMac
103
103
  } from "./index-7cb4x1vj.js";
@@ -43,7 +43,8 @@ export declare function hasStrip(knobs: Pick<DevknobsState, "width" | "height" |
43
43
  * device pixel ratio's `zoom` on the frame keeps its css size too, and the
44
44
  * wrapper takes it back out of the drawing. A device's mock takes `mock` px
45
45
  * of the frame's on each side, drawn at the same scale, and the whole of it
46
- * is fitted and centered.
46
+ * is fitted and centered. With a mock, a fit is drawn a hair smaller so the
47
+ * screen is a whole number of the `ratio`'s device pixels tall.
47
48
  */
48
49
  export declare function fit(knobs: Pick<DevknobsState, "width" | "height" | "zoom">, size: {
49
50
  width: number;
@@ -53,6 +54,7 @@ export declare function fit(knobs: Pick<DevknobsState, "width" | "height" | "zoo
53
54
  aside?: number;
54
55
  side?: SideValue;
55
56
  mock?: Sides;
57
+ ratio?: number;
56
58
  }): Fit;
57
59
  /**
58
60
  * Where the frame's top left sits in the scrolled content of a stage of
@@ -74,3 +76,16 @@ export declare function label(place: Fit, knobs: Pick<DevknobsState, "dpr" | "he
74
76
  width: number;
75
77
  height: number;
76
78
  }): string;
79
+ /**
80
+ * `scale`, made at most a device pixel smaller so `length` css px drawn at it
81
+ * spans a whole number of device pixels at `ratio` device px per css px. A
82
+ * scale of 1 stays, so a frame drawn at its own size stays sharp.
83
+ */
84
+ export declare function snapScale(scale: number, length: number, ratio: number): number;
85
+ /**
86
+ * How far to move an edge at `at` css px, under half a device pixel, so it
87
+ * lands on a whole device pixel at `ratio`. A rounded screen's clip on an
88
+ * edge between device pixels draws that row part way, blended with what is
89
+ * behind it.
90
+ */
91
+ export declare function snapShift(at: number, ratio: number): number;
@@ -6,8 +6,10 @@ import type { Mock, Radius } from "./mock";
6
6
  * mat would show through as a light line. The rim of the body there is black.
7
7
  */
8
8
  export declare const UNDER = 2;
9
+ /** How many device pixels of the screen's edge go black with the body's rim. */
10
+ export declare const RING = 2;
9
11
  /** A device's body over the frame, drawn by `drawMock`, in the letterbox's shadow root. */
10
- export declare const MOCK_CSS = "\n/* Clips the frame to the screen's corners in a mock, in the body's color so\n no blue shows at the seam. */\n.glass.mocked {\n position: absolute;\n overflow: hidden;\n background: #111112;\n}\n/* Over the frame, and never in the way of a pointer. */\n.mock {\n position: absolute;\n top: 0;\n left: 0;\n overflow: visible;\n pointer-events: none;\n}\n.mock .band { fill: #48484a; fill-rule: evenodd; }\n.mock .body { fill: #111112; fill-rule: evenodd; }\n.mock .button { fill: #48484a; }\n.mock .sensor { fill: #000; }\n.mock .slot { fill: #2a2a2c; }\n.mock .lens { fill: #000; stroke: #2a2a2c; stroke-width: 1; }\n.mock .home { fill: #2a2a2c; }\n.mock .key { fill: #111112; }";
12
+ export declare const MOCK_CSS = "\n/* Clips the frame to the screen's corners in a mock, in the body's color so\n no blue shows at the seam. */\n.glass.mocked {\n position: absolute;\n overflow: hidden;\n background: #111112;\n}\n/* Black over the screen's edge, under the body, never in the way of a pointer. */\n.ring {\n position: absolute;\n box-sizing: border-box;\n pointer-events: none;\n}\n/* Over the frame, and never in the way of a pointer. */\n.mock {\n position: absolute;\n top: 0;\n left: 0;\n overflow: visible;\n pointer-events: none;\n}\n.mock .band { fill: #48484a; fill-rule: evenodd; }\n.mock .body { fill: #111112; fill-rule: evenodd; }\n.mock .button { fill: #48484a; }\n.mock .sensor { fill: #000; }\n.mock .slot { fill: #2a2a2c; }\n.mock .lens { fill: #000; stroke: #2a2a2c; stroke-width: 1; }\n.mock .home { fill: #2a2a2c; }\n.mock .key { fill: #111112; }";
11
13
  /** The radius of each corner, from the top left round by the right, `by` added to each. */
12
14
  export declare function corners(radius: Radius, by?: number): [number, number, number, number];
13
15
  /**
@@ -5765,7 +5765,7 @@ function margin(size) {
5765
5765
  return Math.min(MARGIN, size / 4);
5766
5766
  }
5767
5767
  function fit(knobs2, size, options = {}) {
5768
- const { frameZoom = 1, aside = 0, side = "right", mock = BARE } = options;
5768
+ const { frameZoom = 1, aside = 0, side = "right", mock = BARE, ratio = 0 } = options;
5769
5769
  const room = {
5770
5770
  width: size.width,
5771
5771
  height: Math.max(0, size.height - (hasStrip(knobs2) ? STRIP : 0))
@@ -5782,7 +5782,8 @@ function fit(knobs2, size, options = {}) {
5782
5782
  const height = typeof knobs2.height === "number" ? knobs2.height : room.height / whole;
5783
5783
  const outer = { width: width + sides.width, height: height + sides.height };
5784
5784
  const covered = sized && aside > 0 && aside <= room.width / 2 && (room.width + outer.width * whole) / 2 + x > room.width - aside;
5785
- const fitted = covered ? Math.min(whole, (room.width - aside - 2 * x) / outer.width) : whole;
5785
+ const loose = covered ? Math.min(whole, (room.width - aside - 2 * x) / outer.width) : whole;
5786
+ const fitted = mock === BARE ? loose : snapScale(loose, height, ratio);
5786
5787
  const scale = knobs2.zoom === "fit" ? fitted : knobs2.zoom;
5787
5788
  const beside = knobs2.zoom === "fit" && covered ? aside : 0;
5788
5789
  const before = side === "left" ? beside : 0;
@@ -5813,6 +5814,17 @@ function label(place2, knobs2, page = place2) {
5813
5814
  text += ` · ${knobs2.dpr}x`;
5814
5815
  return text;
5815
5816
  }
5817
+ function snapScale(scale, length, ratio) {
5818
+ if (!(ratio > 0) || !(scale > 0) || !(length > 0) || scale === 1)
5819
+ return scale;
5820
+ const pixels = Math.floor(length * scale * ratio + 0.000001);
5821
+ return pixels > 0 ? pixels / ratio / length : scale;
5822
+ }
5823
+ function snapShift(at, ratio) {
5824
+ if (!(ratio > 0))
5825
+ return 0;
5826
+ return Math.round(at * ratio) / ratio - at;
5827
+ }
5816
5828
 
5817
5829
  // src/engine/mat.ts
5818
5830
  function colorRules() {
@@ -6435,6 +6447,7 @@ var EDGE = "#48484a";
6435
6447
  var RIM2 = "#2a2a2c";
6436
6448
  var BAND = 2.5;
6437
6449
  var UNDER = 2;
6450
+ var RING = 2;
6438
6451
  var MOCK_CSS = `
6439
6452
  /* Clips the frame to the screen's corners in a mock, in the body's color so
6440
6453
  no blue shows at the seam. */
@@ -6443,6 +6456,12 @@ var MOCK_CSS = `
6443
6456
  overflow: hidden;
6444
6457
  background: ${BODY};
6445
6458
  }
6459
+ /* Black over the screen's edge, under the body, never in the way of a pointer. */
6460
+ .ring {
6461
+ position: absolute;
6462
+ box-sizing: border-box;
6463
+ pointer-events: none;
6464
+ }
6446
6465
  /* Over the frame, and never in the way of a pointer. */
6447
6466
  .mock {
6448
6467
  position: absolute;
@@ -8649,6 +8668,9 @@ var browser = null;
8649
8668
  var touchDot = null;
8650
8669
  var turnCover = null;
8651
8670
  var mockDrawing = null;
8671
+ var ring2 = null;
8672
+ var density2 = null;
8673
+ var densityRatio = 0;
8652
8674
  var mockKey = "";
8653
8675
  var frame3 = null;
8654
8676
  var readout = null;
@@ -9026,19 +9048,46 @@ function showMock(mock, place2) {
9026
9048
  if (mockDrawing)
9027
9049
  screen.append(mockDrawing);
9028
9050
  glass.className = mock ? "glass mocked" : "glass";
9051
+ ring2?.remove();
9052
+ ring2 = mock ? document.createElement("div") : null;
9053
+ if (ring2) {
9054
+ ring2.className = "ring";
9055
+ glass.after(ring2);
9056
+ }
9029
9057
  }
9030
9058
  const zoom = place2.zoom;
9031
9059
  glass.style.left = mock ? `${mock.inset.left * zoom}px` : "";
9032
9060
  glass.style.top = mock ? `${mock.inset.top * zoom}px` : "";
9033
9061
  const round4 = mock ? corners(mock.screenRadius).map((radius) => `${radius * zoom}px`) : [];
9034
9062
  glass.style.borderRadius = round4.join(" ");
9035
- glass.style.boxShadow = href ? `0 0 0 ${UNDER * zoom}px #000` : "";
9063
+ if (mock && ring2)
9064
+ showRing(mock, place2);
9036
9065
  if (mock && mockDrawing) {
9037
9066
  mockDrawing.style.width = `${mock.width * zoom}px`;
9038
9067
  mockDrawing.style.height = `${mock.height * zoom}px`;
9039
9068
  }
9040
9069
  }
9041
- function showBrowser(bars, page, place2, follow5) {
9070
+ function showRing(mock, place2) {
9071
+ if (!ring2)
9072
+ return;
9073
+ const zoom = place2.zoom;
9074
+ const ratio = window.devicePixelRatio || 1;
9075
+ const width = UNDER * zoom + RING / (ratio * place2.transform);
9076
+ ring2.style.left = `${(mock.inset.left - UNDER) * zoom}px`;
9077
+ ring2.style.top = `${(mock.inset.top - UNDER) * zoom}px`;
9078
+ ring2.style.width = `${(place2.width + 2 * UNDER) * zoom}px`;
9079
+ ring2.style.height = `${(place2.height + 2 * UNDER) * zoom}px`;
9080
+ ring2.style.borderRadius = corners(mock.screenRadius, UNDER).map((radius) => `${radius * zoom}px`).join(" ");
9081
+ ring2.style.boxShadow = `inset 0 0 0 ${width}px #000`;
9082
+ }
9083
+ function pageInset(page, place2) {
9084
+ if (!page)
9085
+ return "0";
9086
+ const zoom = place2.zoom;
9087
+ const sides = [page.y, place2.width - page.x - page.width, place2.height - page.y - page.height, page.x];
9088
+ return sides.map((side) => `${-side * zoom}px`).join(" ");
9089
+ }
9090
+ function showBrowser(bars, page, place2, follow5, radii) {
9042
9091
  if (!glass || !pageBox || !browser)
9043
9092
  return;
9044
9093
  const zoom = place2.zoom;
@@ -9051,6 +9100,7 @@ function showBrowser(bars, page, place2, follow5) {
9051
9100
  box2.className = page ? "page placed" : "page";
9052
9101
  box2.style.left = page ? `${page.x * zoom}px` : "";
9053
9102
  box2.style.top = page ? `${page.y * zoom}px` : "";
9103
+ box2.style.clipPath = radii ? `inset(${pageInset(page, place2)} round ${radii})` : "";
9054
9104
  };
9055
9105
  glass.style.width = page ? `${place2.width * zoom}px` : "";
9056
9106
  glass.style.height = page ? `${place2.height * zoom}px` : "";
@@ -9078,6 +9128,21 @@ function bodyFor(value) {
9078
9128
  return body && over2 && openUpright(shapeOf(value)) ? flipMock(body) : body;
9079
9129
  }
9080
9130
  var over2 = false;
9131
+ function watchDensity() {
9132
+ const ratio = window.devicePixelRatio;
9133
+ if (ratio === densityRatio || typeof window.matchMedia !== "function")
9134
+ return;
9135
+ unwatchDensity();
9136
+ density2 = baseMatchMedia(`(resolution: ${ratio}dppx)`);
9137
+ density2.onchange = resize;
9138
+ densityRatio = ratio;
9139
+ }
9140
+ function unwatchDensity() {
9141
+ if (density2)
9142
+ density2.onchange = null;
9143
+ density2 = null;
9144
+ densityRatio = 0;
9145
+ }
9081
9146
  function resize() {
9082
9147
  if (!frame3 || !letterbox || !stage || !drawing || !screen || !readout || !caption)
9083
9148
  return;
@@ -9093,7 +9158,8 @@ function resize() {
9093
9158
  frameZoom: zoomFor(current.dpr),
9094
9159
  aside,
9095
9160
  side: current.panel.side,
9096
- mock: mock?.inset
9161
+ mock: mock?.inset,
9162
+ ratio: window.devicePixelRatio
9097
9163
  });
9098
9164
  drawn = place2;
9099
9165
  drawnAt(placeKey(origin(place2, size), place2.transform));
@@ -9110,12 +9176,17 @@ function resize() {
9110
9176
  showMat(size);
9111
9177
  stage.style.overflow = current.zoom === "fit" ? "hidden" : "";
9112
9178
  frame3.style.zoom = place2.zoom === 1 ? "" : String(place2.zoom);
9113
- showBrowser(bars, page, place2, auto);
9179
+ const radii = mock ? corners(mock.screenRadius).map((radius) => `${radius * place2.zoom}px`) : [];
9180
+ showBrowser(bars, page, place2, auto, radii.join(" "));
9114
9181
  touchDot?.fit(place2, place2.zoom);
9115
9182
  drawing.style.width = `${place2.box.width}px`;
9116
9183
  drawing.style.height = `${place2.box.height}px`;
9117
- screen.style.left = `${place2.left - (mock?.inset.left ?? 0) * place2.scale}px`;
9118
- screen.style.top = `${place2.top - (mock?.inset.top ?? 0) * place2.scale}px`;
9184
+ const at = mock ? drawing.getBoundingClientRect() : null;
9185
+ const ratio = window.devicePixelRatio;
9186
+ const nudge = at ? { x: snapShift(at.left + place2.left, ratio), y: snapShift(at.top + place2.top, ratio) } : null;
9187
+ screen.style.left = `${place2.left - (mock?.inset.left ?? 0) * place2.scale + (nudge?.x ?? 0)}px`;
9188
+ screen.style.top = `${place2.top - (mock?.inset.top ?? 0) * place2.scale + (nudge?.y ?? 0)}px`;
9189
+ watchDensity();
9119
9190
  showMock(mock, place2);
9120
9191
  screen.style.transform = place2.transform === 1 ? "" : `scale(${place2.transform})`;
9121
9192
  const native = current.scheme !== "system" && handsSchemeDown(frame3.getRootNode());
@@ -9224,16 +9295,20 @@ function screenFor(value) {
9224
9295
  frameZoom: zoomFor(value.dpr),
9225
9296
  aside: asideOf(value.panel),
9226
9297
  side: value.panel.side,
9227
- mock: mock?.inset
9298
+ mock: mock?.inset,
9299
+ ratio: window.devicePixelRatio
9228
9300
  });
9229
9301
  const room2 = { width: stage.clientWidth, height: stage.clientHeight };
9230
9302
  const at = origin(place2, room2);
9231
9303
  const box2 = letterbox.getBoundingClientRect();
9232
9304
  const view = stage.getBoundingClientRect();
9233
9305
  const scrolled = (scroll2, length, room3) => Math.min(scroll2, Math.max(0, length - room3));
9306
+ const left = view.left + at.x - scrolled(stage.scrollLeft, place2.box.width, room2.width);
9307
+ const top = view.top + at.y - scrolled(stage.scrollTop, place2.box.height, room2.height);
9308
+ const ratio = mock ? window.devicePixelRatio : 0;
9234
9309
  return {
9235
- x: view.left - box2.left + at.x - scrolled(stage.scrollLeft, place2.box.width, room2.width),
9236
- y: view.top - box2.top + at.y - scrolled(stage.scrollTop, place2.box.height, room2.height),
9310
+ x: left + snapShift(left, ratio) - box2.left,
9311
+ y: top + snapShift(top, ratio) - box2.top,
9237
9312
  width: place2.width * place2.scale,
9238
9313
  height: place2.height * place2.scale
9239
9314
  };
@@ -9537,6 +9612,7 @@ function release(follow5) {
9537
9612
  window.removeEventListener("message", onMessage);
9538
9613
  window.removeEventListener("resize", resize);
9539
9614
  window.removeEventListener("pagehide", keep2);
9615
+ unwatchDensity();
9540
9616
  frame3?.removeEventListener("load", onLoad);
9541
9617
  readyPage = null;
9542
9618
  touchDot?.apply(false);
@@ -9571,6 +9647,7 @@ function teardown() {
9571
9647
  touchDot = null;
9572
9648
  turnCover = null;
9573
9649
  mockDrawing = null;
9650
+ ring2 = null;
9574
9651
  mockKey = "";
9575
9652
  frame3 = null;
9576
9653
  hideCover();
@@ -5766,7 +5766,7 @@ function margin(size) {
5766
5766
  return Math.min(MARGIN, size / 4);
5767
5767
  }
5768
5768
  function fit(knobs2, size, options = {}) {
5769
- const { frameZoom = 1, aside = 0, side = "right", mock = BARE } = options;
5769
+ const { frameZoom = 1, aside = 0, side = "right", mock = BARE, ratio = 0 } = options;
5770
5770
  const room = {
5771
5771
  width: size.width,
5772
5772
  height: Math.max(0, size.height - (hasStrip(knobs2) ? STRIP : 0))
@@ -5783,7 +5783,8 @@ function fit(knobs2, size, options = {}) {
5783
5783
  const height = typeof knobs2.height === "number" ? knobs2.height : room.height / whole;
5784
5784
  const outer = { width: width + sides.width, height: height + sides.height };
5785
5785
  const covered = sized && aside > 0 && aside <= room.width / 2 && (room.width + outer.width * whole) / 2 + x > room.width - aside;
5786
- const fitted = covered ? Math.min(whole, (room.width - aside - 2 * x) / outer.width) : whole;
5786
+ const loose = covered ? Math.min(whole, (room.width - aside - 2 * x) / outer.width) : whole;
5787
+ const fitted = mock === BARE ? loose : snapScale(loose, height, ratio);
5787
5788
  const scale = knobs2.zoom === "fit" ? fitted : knobs2.zoom;
5788
5789
  const beside = knobs2.zoom === "fit" && covered ? aside : 0;
5789
5790
  const before = side === "left" ? beside : 0;
@@ -5814,6 +5815,17 @@ function label(place2, knobs2, page = place2) {
5814
5815
  text += ` · ${knobs2.dpr}x`;
5815
5816
  return text;
5816
5817
  }
5818
+ function snapScale(scale, length, ratio) {
5819
+ if (!(ratio > 0) || !(scale > 0) || !(length > 0) || scale === 1)
5820
+ return scale;
5821
+ const pixels = Math.floor(length * scale * ratio + 0.000001);
5822
+ return pixels > 0 ? pixels / ratio / length : scale;
5823
+ }
5824
+ function snapShift(at, ratio) {
5825
+ if (!(ratio > 0))
5826
+ return 0;
5827
+ return Math.round(at * ratio) / ratio - at;
5828
+ }
5817
5829
 
5818
5830
  // src/engine/mat.ts
5819
5831
  function colorRules() {
@@ -6436,6 +6448,7 @@ var EDGE = "#48484a";
6436
6448
  var RIM2 = "#2a2a2c";
6437
6449
  var BAND = 2.5;
6438
6450
  var UNDER = 2;
6451
+ var RING = 2;
6439
6452
  var MOCK_CSS = `
6440
6453
  /* Clips the frame to the screen's corners in a mock, in the body's color so
6441
6454
  no blue shows at the seam. */
@@ -6444,6 +6457,12 @@ var MOCK_CSS = `
6444
6457
  overflow: hidden;
6445
6458
  background: ${BODY};
6446
6459
  }
6460
+ /* Black over the screen's edge, under the body, never in the way of a pointer. */
6461
+ .ring {
6462
+ position: absolute;
6463
+ box-sizing: border-box;
6464
+ pointer-events: none;
6465
+ }
6447
6466
  /* Over the frame, and never in the way of a pointer. */
6448
6467
  .mock {
6449
6468
  position: absolute;
@@ -8650,6 +8669,9 @@ var browser = null;
8650
8669
  var touchDot = null;
8651
8670
  var turnCover = null;
8652
8671
  var mockDrawing = null;
8672
+ var ring2 = null;
8673
+ var density2 = null;
8674
+ var densityRatio = 0;
8653
8675
  var mockKey = "";
8654
8676
  var frame3 = null;
8655
8677
  var readout = null;
@@ -9027,19 +9049,46 @@ function showMock(mock, place2) {
9027
9049
  if (mockDrawing)
9028
9050
  screen.append(mockDrawing);
9029
9051
  glass.className = mock ? "glass mocked" : "glass";
9052
+ ring2?.remove();
9053
+ ring2 = mock ? document.createElement("div") : null;
9054
+ if (ring2) {
9055
+ ring2.className = "ring";
9056
+ glass.after(ring2);
9057
+ }
9030
9058
  }
9031
9059
  const zoom = place2.zoom;
9032
9060
  glass.style.left = mock ? `${mock.inset.left * zoom}px` : "";
9033
9061
  glass.style.top = mock ? `${mock.inset.top * zoom}px` : "";
9034
9062
  const round4 = mock ? corners(mock.screenRadius).map((radius) => `${radius * zoom}px`) : [];
9035
9063
  glass.style.borderRadius = round4.join(" ");
9036
- glass.style.boxShadow = href ? `0 0 0 ${UNDER * zoom}px #000` : "";
9064
+ if (mock && ring2)
9065
+ showRing(mock, place2);
9037
9066
  if (mock && mockDrawing) {
9038
9067
  mockDrawing.style.width = `${mock.width * zoom}px`;
9039
9068
  mockDrawing.style.height = `${mock.height * zoom}px`;
9040
9069
  }
9041
9070
  }
9042
- function showBrowser(bars, page, place2, follow5) {
9071
+ function showRing(mock, place2) {
9072
+ if (!ring2)
9073
+ return;
9074
+ const zoom = place2.zoom;
9075
+ const ratio = window.devicePixelRatio || 1;
9076
+ const width = UNDER * zoom + RING / (ratio * place2.transform);
9077
+ ring2.style.left = `${(mock.inset.left - UNDER) * zoom}px`;
9078
+ ring2.style.top = `${(mock.inset.top - UNDER) * zoom}px`;
9079
+ ring2.style.width = `${(place2.width + 2 * UNDER) * zoom}px`;
9080
+ ring2.style.height = `${(place2.height + 2 * UNDER) * zoom}px`;
9081
+ ring2.style.borderRadius = corners(mock.screenRadius, UNDER).map((radius) => `${radius * zoom}px`).join(" ");
9082
+ ring2.style.boxShadow = `inset 0 0 0 ${width}px #000`;
9083
+ }
9084
+ function pageInset(page, place2) {
9085
+ if (!page)
9086
+ return "0";
9087
+ const zoom = place2.zoom;
9088
+ const sides = [page.y, place2.width - page.x - page.width, place2.height - page.y - page.height, page.x];
9089
+ return sides.map((side) => `${-side * zoom}px`).join(" ");
9090
+ }
9091
+ function showBrowser(bars, page, place2, follow5, radii) {
9043
9092
  if (!glass || !pageBox || !browser)
9044
9093
  return;
9045
9094
  const zoom = place2.zoom;
@@ -9052,6 +9101,7 @@ function showBrowser(bars, page, place2, follow5) {
9052
9101
  box2.className = page ? "page placed" : "page";
9053
9102
  box2.style.left = page ? `${page.x * zoom}px` : "";
9054
9103
  box2.style.top = page ? `${page.y * zoom}px` : "";
9104
+ box2.style.clipPath = radii ? `inset(${pageInset(page, place2)} round ${radii})` : "";
9055
9105
  };
9056
9106
  glass.style.width = page ? `${place2.width * zoom}px` : "";
9057
9107
  glass.style.height = page ? `${place2.height * zoom}px` : "";
@@ -9079,6 +9129,21 @@ function bodyFor(value) {
9079
9129
  return body && over2 && openUpright(shapeOf(value)) ? flipMock(body) : body;
9080
9130
  }
9081
9131
  var over2 = false;
9132
+ function watchDensity() {
9133
+ const ratio = window.devicePixelRatio;
9134
+ if (ratio === densityRatio || typeof window.matchMedia !== "function")
9135
+ return;
9136
+ unwatchDensity();
9137
+ density2 = baseMatchMedia(`(resolution: ${ratio}dppx)`);
9138
+ density2.onchange = resize;
9139
+ densityRatio = ratio;
9140
+ }
9141
+ function unwatchDensity() {
9142
+ if (density2)
9143
+ density2.onchange = null;
9144
+ density2 = null;
9145
+ densityRatio = 0;
9146
+ }
9082
9147
  function resize() {
9083
9148
  if (!frame3 || !letterbox || !stage || !drawing || !screen || !readout || !caption)
9084
9149
  return;
@@ -9094,7 +9159,8 @@ function resize() {
9094
9159
  frameZoom: zoomFor(current.dpr),
9095
9160
  aside,
9096
9161
  side: current.panel.side,
9097
- mock: mock?.inset
9162
+ mock: mock?.inset,
9163
+ ratio: window.devicePixelRatio
9098
9164
  });
9099
9165
  drawn = place2;
9100
9166
  drawnAt(placeKey(origin(place2, size), place2.transform));
@@ -9111,12 +9177,17 @@ function resize() {
9111
9177
  showMat(size);
9112
9178
  stage.style.overflow = current.zoom === "fit" ? "hidden" : "";
9113
9179
  frame3.style.zoom = place2.zoom === 1 ? "" : String(place2.zoom);
9114
- showBrowser(bars, page, place2, auto);
9180
+ const radii = mock ? corners(mock.screenRadius).map((radius) => `${radius * place2.zoom}px`) : [];
9181
+ showBrowser(bars, page, place2, auto, radii.join(" "));
9115
9182
  touchDot?.fit(place2, place2.zoom);
9116
9183
  drawing.style.width = `${place2.box.width}px`;
9117
9184
  drawing.style.height = `${place2.box.height}px`;
9118
- screen.style.left = `${place2.left - (mock?.inset.left ?? 0) * place2.scale}px`;
9119
- screen.style.top = `${place2.top - (mock?.inset.top ?? 0) * place2.scale}px`;
9185
+ const at = mock ? drawing.getBoundingClientRect() : null;
9186
+ const ratio = window.devicePixelRatio;
9187
+ const nudge = at ? { x: snapShift(at.left + place2.left, ratio), y: snapShift(at.top + place2.top, ratio) } : null;
9188
+ screen.style.left = `${place2.left - (mock?.inset.left ?? 0) * place2.scale + (nudge?.x ?? 0)}px`;
9189
+ screen.style.top = `${place2.top - (mock?.inset.top ?? 0) * place2.scale + (nudge?.y ?? 0)}px`;
9190
+ watchDensity();
9120
9191
  showMock(mock, place2);
9121
9192
  screen.style.transform = place2.transform === 1 ? "" : `scale(${place2.transform})`;
9122
9193
  const native = current.scheme !== "system" && handsSchemeDown(frame3.getRootNode());
@@ -9225,16 +9296,20 @@ function screenFor(value) {
9225
9296
  frameZoom: zoomFor(value.dpr),
9226
9297
  aside: asideOf(value.panel),
9227
9298
  side: value.panel.side,
9228
- mock: mock?.inset
9299
+ mock: mock?.inset,
9300
+ ratio: window.devicePixelRatio
9229
9301
  });
9230
9302
  const room2 = { width: stage.clientWidth, height: stage.clientHeight };
9231
9303
  const at = origin(place2, room2);
9232
9304
  const box2 = letterbox.getBoundingClientRect();
9233
9305
  const view = stage.getBoundingClientRect();
9234
9306
  const scrolled = (scroll2, length, room3) => Math.min(scroll2, Math.max(0, length - room3));
9307
+ const left = view.left + at.x - scrolled(stage.scrollLeft, place2.box.width, room2.width);
9308
+ const top = view.top + at.y - scrolled(stage.scrollTop, place2.box.height, room2.height);
9309
+ const ratio = mock ? window.devicePixelRatio : 0;
9235
9310
  return {
9236
- x: view.left - box2.left + at.x - scrolled(stage.scrollLeft, place2.box.width, room2.width),
9237
- y: view.top - box2.top + at.y - scrolled(stage.scrollTop, place2.box.height, room2.height),
9311
+ x: left + snapShift(left, ratio) - box2.left,
9312
+ y: top + snapShift(top, ratio) - box2.top,
9238
9313
  width: place2.width * place2.scale,
9239
9314
  height: place2.height * place2.scale
9240
9315
  };
@@ -9538,6 +9613,7 @@ function release(follow5) {
9538
9613
  window.removeEventListener("message", onMessage);
9539
9614
  window.removeEventListener("resize", resize);
9540
9615
  window.removeEventListener("pagehide", keep2);
9616
+ unwatchDensity();
9541
9617
  frame3?.removeEventListener("load", onLoad);
9542
9618
  readyPage = null;
9543
9619
  touchDot?.apply(false);
@@ -9572,6 +9648,7 @@ function teardown() {
9572
9648
  touchDot = null;
9573
9649
  turnCover = null;
9574
9650
  mockDrawing = null;
9651
+ ring2 = null;
9575
9652
  mockKey = "";
9576
9653
  frame3 = null;
9577
9654
  hideCover();
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  frameWindow,
6
6
  subscribe
7
- } from "./index-x59vz1xx.js";
7
+ } from "./index-ggf32ddy.js";
8
8
  import {
9
9
  inField,
10
10
  isFunctionKey,
@@ -164,7 +164,7 @@ function systemScheme() {
164
164
  host.remove();
165
165
  return dark ? "dark" : "light";
166
166
  }
167
- function createGrab(options = {}, loadMode = () => import("./index-f67wctn3.js")) {
167
+ function createGrab(options = {}, loadMode = () => import("./index-44a62hfx.js")) {
168
168
  const keyNow = options.key ?? defaultGrabKey;
169
169
  const { purpose } = options;
170
170
  const channel = purpose?.channel ?? "grab";
@@ -373,7 +373,7 @@ function held(view) {
373
373
  return null;
374
374
  }
375
375
  }
376
- function createInspect(options = {}, load = () => import("./index-f67wctn3.js"), frameOf = frameWindow) {
376
+ function createInspect(options = {}, load = () => import("./index-44a62hfx.js"), frameOf = frameWindow) {
377
377
  const inFrame = isDevknobsFrame();
378
378
  const listeners = new Set;
379
379
  let outliner = null;
@@ -6,7 +6,7 @@ import {
6
6
  grabColor,
7
7
  isCLike,
8
8
  isElement
9
- } from "./index-f60yax1j.js";
9
+ } from "./index-1by1n6p4.js";
10
10
  import {
11
11
  componentOf,
12
12
  escapeText,
@@ -33,7 +33,7 @@ import {
33
33
  holdInTopLayer,
34
34
  pause,
35
35
  subscribe
36
- } from "./index-x59vz1xx.js";
36
+ } from "./index-ggf32ddy.js";
37
37
  import"./index-7cb4x1vj.js";
38
38
  import {
39
39
  composedParent,
@@ -1132,7 +1132,7 @@ function holdInTopLayer(host, rank) {
1132
1132
 
1133
1133
  // src/engine/frames.ts
1134
1134
  var kit = null;
1135
- var load2 = () => import("./framekit-yx612r28.js");
1135
+ var load2 = () => import("./framekit-3bmkm34m.js");
1136
1136
  var loading = null;
1137
1137
  var down = false;
1138
1138
  var waiting = [];
@@ -7,7 +7,7 @@ import {
7
7
  } from "./index-4a4x1bt2.js";
8
8
  import {
9
9
  getState
10
- } from "./index-x59vz1xx.js";
10
+ } from "./index-ggf32ddy.js";
11
11
  import {
12
12
  icon
13
13
  } from "./index-6bc2ztfd.js";
@@ -324,7 +324,7 @@ function createPane(context) {
324
324
  // src/ui/storageaction.ts
325
325
  var STORAGE_VIEW = "storage";
326
326
  function load() {
327
- return import("./storageview-pzn8yaad.js").then((loaded) => loaded.storageView({
327
+ return import("./storageview-cth4ysxw.js").then((loaded) => loaded.storageView({
328
328
  visible: () => getState().panel.open && !document.hidden
329
329
  }));
330
330
  }
@@ -7,7 +7,7 @@ import {
7
7
  grabColor,
8
8
  isCLike,
9
9
  isElement
10
- } from "./react-v8497a41.js";
10
+ } from "./react-c98apxzz.js";
11
11
  import {
12
12
  componentOf,
13
13
  escapeText,
@@ -34,7 +34,7 @@ import {
34
34
  holdInTopLayer,
35
35
  pause,
36
36
  subscribe
37
- } from "./react-cs62p9qh.js";
37
+ } from "./react-myz2rvvn.js";
38
38
  import"./react-ttj8f9qp.js";
39
39
  import {
40
40
  composedParent,