@vinena/knobs 0.6.0 → 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 +9 -0
- package/dist/edit/keep.d.ts +1 -1
- package/dist/{elementsview-fyc06wjt.js → elementsview-ffh56hbj.js} +77 -17
- package/dist/{elementsview-k6zvvcne.js → elementsview-nhm5k473.js} +77 -17
- 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-f60yax1j.js → index-1by1n6p4.js} +3 -3
- package/dist/{index-f67wctn3.js → index-44a62hfx.js} +2 -2
- package/dist/{index-x59vz1xx.js → index-ggf32ddy.js} +1 -1
- package/dist/{index-aynkv7qk.js → index-v67kqq9p.js} +2 -2
- package/dist/{index-kfdzsyyw.js → index-xeg2j4r8.js} +2 -2
- package/dist/index.global.js +172 -139
- package/dist/index.js +98 -12
- package/dist/{react-v8497a41.js → react-c98apxzz.js} +3 -3
- package/dist/{react-cs62p9qh.js → react-myz2rvvn.js} +1 -1
- package/dist/{react-6t4dbdzn.js → react-vtcq394z.js} +2 -2
- package/dist/react.js +98 -12
- package/dist/{storageview-pzn8yaad.js → storageview-cth4ysxw.js} +2 -2
- package/dist/{storageview-6xj7zb63.js → storageview-rs5drb7m.js} +2 -2
- package/dist/ui/elementsview.d.ts +3 -5
- package/dist/ui/settings.d.ts +20 -1
- package/package.json +1 -1
- package/skills/devknobs/SKILL.md +1 -1
|
@@ -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();
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
frameWindow,
|
|
6
6
|
subscribe
|
|
7
|
-
} from "./index-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
37
|
+
} from "./react-myz2rvvn.js";
|
|
38
38
|
import"./react-ttj8f9qp.js";
|
|
39
39
|
import {
|
|
40
40
|
composedParent,
|