@vinena/knobs 0.6.1 → 0.6.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/CHANGELOG.md +8 -0
- package/dist/{elementsview-dm5v3z5a.js → elementsview-05qybwpn.js} +6 -6
- package/dist/{elementsview-xm82cvs2.js → elementsview-gjaqje2k.js} +6 -6
- package/dist/engine/fit.d.ts +16 -1
- package/dist/engine/mockdraw.d.ts +3 -1
- package/dist/{framekit-yx612r28.js → framekit-3bmkm34m.js} +88 -11
- package/dist/{framekit-622h6w1f.js → framekit-h0jrc5gs.js} +88 -11
- package/dist/{index-kfdzsyyw.js → index-0mav2k60.js} +3 -3
- package/dist/{index-v0ht9q0g.js → index-0yn3rnza.js} +3 -3
- package/dist/{index-0zp9py56.js → index-4192t60e.js} +1 -1
- package/dist/{index-aynkv7qk.js → index-509g0pa8.js} +4 -4
- package/dist/{index-yb7fc59g.js → index-6xsvcjnc.js} +2 -2
- package/dist/{index-f67wctn3.js → index-aj1z83rt.js} +3 -3
- package/dist/{index-4a4x1bt2.js → index-fp1h37b3.js} +1 -1
- package/dist/{index-f60yax1j.js → index-h93t2tc5.js} +4 -4
- package/dist/{index-x59vz1xx.js → index-kpsrkzmf.js} +2 -2
- package/dist/{index-6bc2ztfd.js → index-rdssc7sz.js} +3 -0
- package/dist/index.global.js +139 -131
- package/dist/index.js +43 -13
- package/dist/{react-cs62p9qh.js → react-2381cr3w.js} +2 -2
- package/dist/{react-6q2cw2ya.js → react-4ykd817s.js} +3 -0
- package/dist/{react-0wepdf60.js → react-anqpcaqm.js} +3 -3
- package/dist/{react-6t4dbdzn.js → react-gkzn5n3v.js} +4 -4
- package/dist/{react-bxzn8vq5.js → react-ptamex0p.js} +1 -1
- package/dist/{react-6bz05qk1.js → react-pvmjybgw.js} +1 -1
- package/dist/{react-88es9b5q.js → react-r3zf2djn.js} +2 -2
- package/dist/{react-v8497a41.js → react-x1ndxf29.js} +4 -4
- package/dist/react.js +43 -13
- package/dist/{replay-j18rw92k.js → replay-39ssrcqp.js} +4 -4
- package/dist/{replay-vtg0vqj2.js → replay-xacjqqt5.js} +4 -4
- package/dist/{storageview-6xj7zb63.js → storageview-3gnncmmv.js} +4 -4
- package/dist/{storageview-pzn8yaad.js → storageview-dwsnvz36.js} +4 -4
- package/dist/ui/icons.d.ts +1 -0
- package/dist/ui/settings.d.ts +7 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.3
|
|
4
|
+
|
|
5
|
+
- a `send feedback` row at the end of the settings opens our feedback page in a new tab, with this knobs version and the page address filled in. the row sends nothing by itself and needs no new permission. the page address it fills in has no query or fragment, so no token in them reaches us
|
|
6
|
+
|
|
7
|
+
## 0.6.2
|
|
8
|
+
|
|
9
|
+
- 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
|
|
10
|
+
|
|
3
11
|
## 0.6.1
|
|
4
12
|
|
|
5
13
|
- 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
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
HTML_MIN,
|
|
5
5
|
forcedSelector,
|
|
6
6
|
forcing
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-6xsvcjnc.js";
|
|
8
8
|
import"./index-58jdczmj.js";
|
|
9
9
|
import {
|
|
10
10
|
HIDE_ATTRIBUTE,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
rulesOf,
|
|
30
30
|
successor,
|
|
31
31
|
textEdit
|
|
32
|
-
} from "./index-
|
|
32
|
+
} from "./index-0yn3rnza.js";
|
|
33
33
|
import {
|
|
34
34
|
compareSpecificity,
|
|
35
35
|
edits,
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
readSavedEdit,
|
|
39
39
|
specificity,
|
|
40
40
|
splitList
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-4192t60e.js";
|
|
42
42
|
import {
|
|
43
43
|
boxValue,
|
|
44
44
|
sizeText
|
|
@@ -93,11 +93,11 @@ import {
|
|
|
93
93
|
segments,
|
|
94
94
|
toolToggle,
|
|
95
95
|
toolbar
|
|
96
|
-
} from "./index-
|
|
96
|
+
} from "./index-fp1h37b3.js";
|
|
97
97
|
import {
|
|
98
98
|
getState,
|
|
99
99
|
subscribe
|
|
100
|
-
} from "./index-
|
|
100
|
+
} from "./index-kpsrkzmf.js";
|
|
101
101
|
import {
|
|
102
102
|
isMac
|
|
103
103
|
} from "./index-7cb4x1vj.js";
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
letterMatches,
|
|
108
108
|
typesInField,
|
|
109
109
|
withShift
|
|
110
|
-
} from "./index-
|
|
110
|
+
} from "./index-rdssc7sz.js";
|
|
111
111
|
import {
|
|
112
112
|
SIDES,
|
|
113
113
|
boxModel,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
HTML_MIN,
|
|
6
6
|
forcedSelector,
|
|
7
7
|
forcing
|
|
8
|
-
} from "./react-
|
|
8
|
+
} from "./react-r3zf2djn.js";
|
|
9
9
|
import"./react-97b5b8j4.js";
|
|
10
10
|
import {
|
|
11
11
|
HIDE_ATTRIBUTE,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
rulesOf,
|
|
31
31
|
successor,
|
|
32
32
|
textEdit
|
|
33
|
-
} from "./react-
|
|
33
|
+
} from "./react-anqpcaqm.js";
|
|
34
34
|
import {
|
|
35
35
|
compareSpecificity,
|
|
36
36
|
edits,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
readSavedEdit,
|
|
40
40
|
specificity,
|
|
41
41
|
splitList
|
|
42
|
-
} from "./react-
|
|
42
|
+
} from "./react-pvmjybgw.js";
|
|
43
43
|
import {
|
|
44
44
|
boxValue,
|
|
45
45
|
sizeText
|
|
@@ -94,11 +94,11 @@ import {
|
|
|
94
94
|
segments,
|
|
95
95
|
toolToggle,
|
|
96
96
|
toolbar
|
|
97
|
-
} from "./react-
|
|
97
|
+
} from "./react-ptamex0p.js";
|
|
98
98
|
import {
|
|
99
99
|
getState,
|
|
100
100
|
subscribe
|
|
101
|
-
} from "./react-
|
|
101
|
+
} from "./react-2381cr3w.js";
|
|
102
102
|
import {
|
|
103
103
|
isMac
|
|
104
104
|
} from "./react-ttj8f9qp.js";
|
|
@@ -108,7 +108,7 @@ import {
|
|
|
108
108
|
letterMatches,
|
|
109
109
|
typesInField,
|
|
110
110
|
withShift
|
|
111
|
-
} from "./react-
|
|
111
|
+
} from "./react-4ykd817s.js";
|
|
112
112
|
import {
|
|
113
113
|
SIDES,
|
|
114
114
|
boxModel,
|
package/dist/engine/fit.d.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
9118
|
-
|
|
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:
|
|
9236
|
-
y:
|
|
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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
9119
|
-
|
|
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:
|
|
9237
|
-
y:
|
|
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();
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
grabColor,
|
|
8
8
|
isCLike,
|
|
9
9
|
isElement
|
|
10
|
-
} from "./react-
|
|
10
|
+
} from "./react-x1ndxf29.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-
|
|
37
|
+
} from "./react-2381cr3w.js";
|
|
38
38
|
import"./react-ttj8f9qp.js";
|
|
39
39
|
import {
|
|
40
40
|
composedParent,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
icon,
|
|
43
43
|
isDevknobs,
|
|
44
44
|
isGrabbable
|
|
45
|
-
} from "./react-
|
|
45
|
+
} from "./react-4ykd817s.js";
|
|
46
46
|
import {
|
|
47
47
|
RINGS,
|
|
48
48
|
addStyle,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
riskyElement,
|
|
6
6
|
specificity,
|
|
7
7
|
splitList
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-4192t60e.js";
|
|
9
9
|
import {
|
|
10
10
|
middle
|
|
11
11
|
} from "./index-ftjdt358.js";
|
|
@@ -18,12 +18,12 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
actButton,
|
|
20
20
|
el
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-fp1h37b3.js";
|
|
22
22
|
import {
|
|
23
23
|
icon,
|
|
24
24
|
isDevknobs,
|
|
25
25
|
typesInField
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-rdssc7sz.js";
|
|
27
27
|
import {
|
|
28
28
|
addStyle,
|
|
29
29
|
authoredQuery,
|
|
@@ -408,7 +408,7 @@ function settled(view, quiet = QUIET, longest = SETTLE_MAX) {
|
|
|
408
408
|
}
|
|
409
409
|
function createKeeper(options) {
|
|
410
410
|
const { log, store, view } = options;
|
|
411
|
-
const loadReplay = options.replay ?? (() => import("./replay-
|
|
411
|
+
const loadReplay = options.replay ?? (() => import("./replay-xacjqqt5.js").then(({ replayEdits }) => replayEdits));
|
|
412
412
|
const wait = options.settled ?? (() => settled(view));
|
|
413
413
|
const frame = options.frame ?? (() => null);
|
|
414
414
|
const ours = new WeakMap;
|