@vinena/knobs 0.5.2 → 0.5.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 +12 -0
- package/dist/early.global.js +5 -5
- package/dist/{elementsview-qn8qyksa.js → elementsview-1wsxcdtj.js} +4 -4
- package/dist/{elementsview-2z4pkrdz.js → elementsview-3kv34jfx.js} +4 -4
- package/dist/engine/browserdraw.d.ts +5 -0
- package/dist/engine/browserkit.d.ts +2 -0
- package/dist/engine/devices.d.ts +3 -2
- package/dist/engine/frames.d.ts +1 -0
- package/dist/engine/identity.d.ts +5 -1
- package/dist/engine/index.d.ts +2 -0
- package/dist/engine/mock.d.ts +0 -2
- package/dist/engine/mockdata.d.ts +4 -3
- package/dist/engine/mockdraw.d.ts +2 -14
- package/dist/engine/morphrun.d.ts +4 -0
- package/dist/engine/native.d.ts +31 -3
- package/dist/engine/notice.d.ts +1 -2
- package/dist/engine/width.d.ts +3 -0
- package/dist/{framekit-w0v516w5.js → framekit-cjz0e4y8.js} +213 -61
- package/dist/{framekit-te90cjs0.js → framekit-yk1jxjv7.js} +213 -61
- package/dist/{index-sxe5079a.js → index-6wbgqkdz.js} +24 -5
- package/dist/{index-dan2kpsd.js → index-9jhatmky.js} +4 -4
- package/dist/{index-30fc6php.js → index-begsqdm0.js} +1 -1
- package/dist/{index-pewcdh28.js → index-j1h13ahg.js} +1 -1
- package/dist/{index-xjhwp5cj.js → index-p57fdttx.js} +38 -23
- package/dist/{index-9re7sv56.js → index-prjpx67p.js} +5 -5
- package/dist/{index-r72tz2vn.js → index-q73py563.js} +1 -1
- package/dist/{index-hv02xka3.js → index-sn2y6j09.js} +5 -5
- package/dist/{index-agwr37gw.js → index-vgfn2n1h.js} +1 -1
- package/dist/{index-trx7bxdk.js → index-zt3rheck.js} +4 -4
- package/dist/index.global.js +183 -154
- package/dist/index.js +39 -13
- package/dist/{react-ayg1bgw3.js → react-3rhdj2k1.js} +24 -5
- package/dist/{react-fm9y8dbn.js → react-6tss0r9f.js} +38 -23
- package/dist/{react-sw8d8c94.js → react-7vjfsh40.js} +4 -4
- package/dist/{react-zy1mmhgz.js → react-806qmkyz.js} +4 -4
- package/dist/{react-4pvp6amm.js → react-gefkdkdz.js} +1 -1
- package/dist/{react-16spgn0h.js → react-mmq2zya3.js} +1 -1
- package/dist/{react-exjcpxma.js → react-qfpg79hs.js} +1 -1
- package/dist/{react-05jh9jv5.js → react-qgz9afa2.js} +1 -1
- package/dist/react.js +39 -13
- package/dist/{storageview-s7heg93p.js → storageview-7cv0vpdm.js} +4 -4
- package/dist/{storageview-r595qpt9.js → storageview-dyhpgt8f.js} +4 -4
- package/dist/types.d.ts +7 -0
- package/dist/ui/settings.d.ts +8 -0
- package/package.json +1 -1
|
@@ -28,12 +28,12 @@ import {
|
|
|
28
28
|
turnOf,
|
|
29
29
|
turnedPose,
|
|
30
30
|
windowRect
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-j1h13ahg.js";
|
|
32
32
|
import {
|
|
33
33
|
hush,
|
|
34
34
|
hushOnce,
|
|
35
35
|
quietFetch
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-q73py563.js";
|
|
37
37
|
import {
|
|
38
38
|
copyText
|
|
39
39
|
} from "./index-ztnjefrh.js";
|
|
@@ -118,7 +118,7 @@ import {
|
|
|
118
118
|
userAgentOf,
|
|
119
119
|
viewportOf,
|
|
120
120
|
wheelZoom
|
|
121
|
-
} from "./index-
|
|
121
|
+
} from "./index-p57fdttx.js";
|
|
122
122
|
|
|
123
123
|
// src/engine/width.ts
|
|
124
124
|
var exports_width = {};
|
|
@@ -130,6 +130,7 @@ __export(exports_width, {
|
|
|
130
130
|
origin: () => origin,
|
|
131
131
|
onZoom: () => onZoom,
|
|
132
132
|
onRefused: () => onRefused,
|
|
133
|
+
onLoader: () => onLoader,
|
|
133
134
|
onFramed: () => onFramed,
|
|
134
135
|
onExit: () => onExit,
|
|
135
136
|
label: () => label,
|
|
@@ -140,16 +141,17 @@ __export(exports_width, {
|
|
|
140
141
|
apply: () => apply3,
|
|
141
142
|
STRIP: () => STRIP,
|
|
142
143
|
RIDE_SLOW: () => RIDE_SLOW,
|
|
143
|
-
FRAME_API_WAIT: () => FRAME_API_WAIT
|
|
144
|
+
FRAME_API_WAIT: () => FRAME_API_WAIT,
|
|
145
|
+
COVER_CAP: () => COVER_CAP
|
|
144
146
|
});
|
|
145
147
|
|
|
146
148
|
// src/engine/identity.ts
|
|
147
149
|
function identityOf(state) {
|
|
148
150
|
const agent = uaPreset(state.ua.preset) ? state.ua.preset : userAgentOf(state.ua);
|
|
149
|
-
return { agent, touch: hasTouch(state.device), dpr: state.dpr };
|
|
151
|
+
return { agent, touch: hasTouch(state.device), dpr: state.dpr, ...state.panel?.realPhone ? { served: true } : {} };
|
|
150
152
|
}
|
|
151
153
|
function stale(loaded, next) {
|
|
152
|
-
return loaded !== null && (loaded.agent !== next.agent || loaded.touch !== next.touch || loaded.dpr !== next.dpr);
|
|
154
|
+
return loaded !== null && (loaded.agent !== next.agent || loaded.touch !== next.touch || loaded.dpr !== next.dpr || (loaded.served ?? false) !== (next.served ?? false));
|
|
153
155
|
}
|
|
154
156
|
var PATCHED = Symbol.for("devknobs.identity");
|
|
155
157
|
function isIdentity(value) {
|
|
@@ -3190,7 +3192,6 @@ function bezelMock(id, orientation) {
|
|
|
3190
3192
|
inset: sides,
|
|
3191
3193
|
body: { x: 0, y: 0, ...size },
|
|
3192
3194
|
screenRadius: turned ? turnRadius(bezel.radius, clockwise) : bezel.radius,
|
|
3193
|
-
continuous: island !== null,
|
|
3194
3195
|
bodyRadius: 0,
|
|
3195
3196
|
parts,
|
|
3196
3197
|
image: {
|
|
@@ -5300,6 +5301,7 @@ function readLook(frame2, probe = null) {
|
|
|
5300
5301
|
background: white,
|
|
5301
5302
|
top: white,
|
|
5302
5303
|
bottom: white,
|
|
5304
|
+
header: false,
|
|
5303
5305
|
footer: false,
|
|
5304
5306
|
under: [],
|
|
5305
5307
|
dark: false,
|
|
@@ -5317,7 +5319,8 @@ function readLook(frame2, probe = null) {
|
|
|
5317
5319
|
const base = backgroundOf(doc, view, scheme === "dark");
|
|
5318
5320
|
const [r, g, b] = base;
|
|
5319
5321
|
const background = rgbText(base);
|
|
5320
|
-
const
|
|
5322
|
+
const header = edgeBar(doc, view, "top", base);
|
|
5323
|
+
const top = header ?? background;
|
|
5321
5324
|
const last = () => colorAt(doc, view, view.innerWidth / 2, view.innerHeight - 1, base);
|
|
5322
5325
|
const footer = edgeBar(doc, view, "bottom", base);
|
|
5323
5326
|
const bottom = footer ?? last() ?? background;
|
|
@@ -5342,6 +5345,7 @@ function readLook(frame2, probe = null) {
|
|
|
5342
5345
|
background,
|
|
5343
5346
|
top,
|
|
5344
5347
|
bottom,
|
|
5348
|
+
header: header !== null,
|
|
5345
5349
|
footer: footer !== null,
|
|
5346
5350
|
under,
|
|
5347
5351
|
dark: luminance(r, g, b) < 0.4,
|
|
@@ -5392,6 +5396,12 @@ function createBrowser(glass, frame2, onChange, onReload = () => {}, ready = ()
|
|
|
5392
5396
|
const band = createUnderbar(glass, frame2);
|
|
5393
5397
|
const layer = el("div", "browser");
|
|
5394
5398
|
layer.setAttribute("aria-hidden", "true");
|
|
5399
|
+
const seams = [el("div", "seam"), el("div", "seam")];
|
|
5400
|
+
for (const seam of seams) {
|
|
5401
|
+
seam.setAttribute("aria-hidden", "true");
|
|
5402
|
+
seam.style.cssText = "position:absolute;pointer-events:none";
|
|
5403
|
+
seam.hidden = true;
|
|
5404
|
+
}
|
|
5395
5405
|
let view = null;
|
|
5396
5406
|
let look = null;
|
|
5397
5407
|
let painted = null;
|
|
@@ -5436,6 +5446,25 @@ function createBrowser(glass, frame2, onChange, onReload = () => {}, ready = ()
|
|
|
5436
5446
|
const bars = view?.bars ?? null;
|
|
5437
5447
|
const shown2 = view && showsBand(bars, look) && reaches(frame2) ? bandRect(applied, view.size.height) : null;
|
|
5438
5448
|
band.show(shown2, view?.zoom ?? 1, look);
|
|
5449
|
+
placeSeams();
|
|
5450
|
+
};
|
|
5451
|
+
const placeSeams = () => {
|
|
5452
|
+
const ratio = glass.offsetWidth > 0 ? glass.getBoundingClientRect().width / glass.offsetWidth : 1;
|
|
5453
|
+
const unit = 1 / ((window.devicePixelRatio || 1) * (ratio || 1));
|
|
5454
|
+
const rects = look && reaches(frame2) ? seamRects(applied, view?.zoom ?? 1, unit, look) : { top: null, bottom: null };
|
|
5455
|
+
const colors = [look?.top ?? "", look?.bottom ?? ""];
|
|
5456
|
+
[rects.top, rects.bottom].forEach((rect, index) => {
|
|
5457
|
+
const seam = seams[index];
|
|
5458
|
+
if (!seam)
|
|
5459
|
+
return;
|
|
5460
|
+
seam.hidden = rect === null;
|
|
5461
|
+
if (!rect)
|
|
5462
|
+
return;
|
|
5463
|
+
if (!seam.isConnected)
|
|
5464
|
+
glass.insertBefore(seam, layer.isConnected ? layer : null);
|
|
5465
|
+
place(seam, rect.x, rect.y, rect.width, rect.height);
|
|
5466
|
+
seam.style.background = colors[index] ?? "";
|
|
5467
|
+
});
|
|
5439
5468
|
};
|
|
5440
5469
|
const resample = () => {
|
|
5441
5470
|
sampling = 0;
|
|
@@ -5653,6 +5682,9 @@ function createBrowser(glass, frame2, onChange, onReload = () => {}, ready = ()
|
|
|
5653
5682
|
view = next;
|
|
5654
5683
|
if (next.bars && !layer.isConnected)
|
|
5655
5684
|
glass.append(layer);
|
|
5685
|
+
for (const seam of seams)
|
|
5686
|
+
if (seam.isConnected)
|
|
5687
|
+
glass.insertBefore(seam, layer.isConnected ? layer : null);
|
|
5656
5688
|
if (!next.bars)
|
|
5657
5689
|
layer.remove();
|
|
5658
5690
|
place(layer, 0, 0, next.size.width, next.size.height);
|
|
@@ -5693,12 +5725,25 @@ function createBrowser(glass, frame2, onChange, onReload = () => {}, ready = ()
|
|
|
5693
5725
|
query = null;
|
|
5694
5726
|
watched2 = null;
|
|
5695
5727
|
layer.remove();
|
|
5728
|
+
for (const seam of seams)
|
|
5729
|
+
seam.remove();
|
|
5696
5730
|
blank.remove();
|
|
5697
5731
|
band.remove();
|
|
5698
5732
|
}
|
|
5699
5733
|
};
|
|
5700
5734
|
return browser;
|
|
5701
5735
|
}
|
|
5736
|
+
function seamRects(page, zoom, unit, look) {
|
|
5737
|
+
if (!page)
|
|
5738
|
+
return { top: null, bottom: null };
|
|
5739
|
+
const x = page.x * zoom;
|
|
5740
|
+
const width = page.width * zoom;
|
|
5741
|
+
const edge = (y) => ({ x, y: y - 2 * unit, width, height: 4 * unit });
|
|
5742
|
+
return {
|
|
5743
|
+
top: look.header ? edge(page.y * zoom) : null,
|
|
5744
|
+
bottom: look.footer ? edge((page.y + page.height) * zoom) : null
|
|
5745
|
+
};
|
|
5746
|
+
}
|
|
5702
5747
|
|
|
5703
5748
|
// src/engine/fit.ts
|
|
5704
5749
|
var STRIP_TOP = 8;
|
|
@@ -6383,7 +6428,6 @@ var EDGE = "#48484a";
|
|
|
6383
6428
|
var RIM2 = "#2a2a2c";
|
|
6384
6429
|
var BAND = 2.5;
|
|
6385
6430
|
var UNDER = 2;
|
|
6386
|
-
var CONTINUOUS = { extent: 1.363, shape: 1.52 };
|
|
6387
6431
|
var MOCK_CSS = `
|
|
6388
6432
|
/* Clips the frame to the screen's corners in a mock, in the body's color so
|
|
6389
6433
|
no blue shows at the seam. */
|
|
@@ -6392,14 +6436,6 @@ var MOCK_CSS = `
|
|
|
6392
6436
|
overflow: hidden;
|
|
6393
6437
|
background: ${BODY};
|
|
6394
6438
|
}
|
|
6395
|
-
/* A phone with an island: its continuous corners where the browser draws
|
|
6396
|
-
them, over the round radius set on it, which the mat still reads. */
|
|
6397
|
-
@supports (corner-shape: superellipse(2)) {
|
|
6398
|
-
.glass.continuous {
|
|
6399
|
-
border-radius: var(--continuous) !important;
|
|
6400
|
-
corner-shape: superellipse(${CONTINUOUS.shape});
|
|
6401
|
-
}
|
|
6402
|
-
}
|
|
6403
6439
|
/* Over the frame, and never in the way of a pointer. */
|
|
6404
6440
|
.mock {
|
|
6405
6441
|
position: absolute;
|
|
@@ -6431,28 +6467,6 @@ function roundRect(rect, radius) {
|
|
|
6431
6467
|
`V${y + a}${arc2(a)} ${x + a} ${y}Z`
|
|
6432
6468
|
].join("");
|
|
6433
6469
|
}
|
|
6434
|
-
function continuousRect(rect, radius) {
|
|
6435
|
-
const { x, y, width, height } = rect;
|
|
6436
|
-
const power = 2 / 2 ** CONTINUOUS.shape;
|
|
6437
|
-
const most = Math.min(width, height) / 2;
|
|
6438
|
-
const lengths = corners(radius).map((r) => Math.max(0, Math.min(r * CONTINUOUS.extent, most)));
|
|
6439
|
-
const ends = [
|
|
6440
|
-
[x, y, 1, 1],
|
|
6441
|
-
[x + width, y, -1, 1],
|
|
6442
|
-
[x + width, y + height, -1, -1],
|
|
6443
|
-
[x, y + height, 1, -1]
|
|
6444
|
-
];
|
|
6445
|
-
const points = ends.flatMap(([cx, cy, sx, sy], at) => {
|
|
6446
|
-
const length = lengths[at] ?? 0;
|
|
6447
|
-
return Array.from({ length: 17 }, (_, step) => {
|
|
6448
|
-
const t = (at % 2 === 0 ? step : 16 - step) / 16 * (Math.PI / 2);
|
|
6449
|
-
const px = cx + sx * length * (1 - Math.cos(t) ** power);
|
|
6450
|
-
const py = cy + sy * length * (1 - Math.sin(t) ** power);
|
|
6451
|
-
return `${px.toFixed(2)} ${py.toFixed(2)}`;
|
|
6452
|
-
});
|
|
6453
|
-
});
|
|
6454
|
-
return `M${points.join("L")}Z`;
|
|
6455
|
-
}
|
|
6456
6470
|
function drawMock(mock, screenSize, href) {
|
|
6457
6471
|
const svg = svgNode("svg", {
|
|
6458
6472
|
class: "mock",
|
|
@@ -6479,10 +6493,9 @@ function drawMock(mock, screenSize, href) {
|
|
|
6479
6493
|
}
|
|
6480
6494
|
const opening = { x: mock.inset.left, y: mock.inset.top, ...screenSize };
|
|
6481
6495
|
const { x, y, width, height } = mock.body;
|
|
6482
|
-
const screen = mock.continuous ? continuousRect : roundRect;
|
|
6483
6496
|
const front = { x: x + BAND, y: y + BAND, width: width - 2 * BAND, height: height - 2 * BAND };
|
|
6484
6497
|
const inside = roundRect(front, corners(mock.bodyRadius, -BAND));
|
|
6485
|
-
svg.append(...mock.parts.filter((shape) => shape.kind === "button").map(part), svgNode("path", { class: "band", d: roundRect(mock.body, mock.bodyRadius) + inside }), svgNode("path", { class: "body", d: inside +
|
|
6498
|
+
svg.append(...mock.parts.filter((shape) => shape.kind === "button").map(part), svgNode("path", { class: "band", d: roundRect(mock.body, mock.bodyRadius) + inside }), svgNode("path", { class: "body", d: inside + roundRect(opening, mock.screenRadius) }), ...mock.parts.filter((shape) => shape.kind !== "button").map(part));
|
|
6486
6499
|
return svg;
|
|
6487
6500
|
}
|
|
6488
6501
|
|
|
@@ -7615,12 +7628,22 @@ function clear3(color) {
|
|
|
7615
7628
|
return color === "" || color === "transparent" || /[,/]\s*0\)$/.test(color);
|
|
7616
7629
|
}
|
|
7617
7630
|
function paintVeil(veil) {
|
|
7631
|
+
veil.className = "veil";
|
|
7618
7632
|
const root = getComputedStyle(document.documentElement);
|
|
7619
7633
|
const body = document.body ? getComputedStyle(document.body).backgroundColor : "";
|
|
7620
7634
|
const color = [root.backgroundColor, body].find((value) => !clear3(value));
|
|
7621
7635
|
veil.style.background = color ?? "Canvas";
|
|
7622
7636
|
veil.style.colorScheme = root.colorScheme || "normal";
|
|
7623
7637
|
}
|
|
7638
|
+
function paintCover(scene) {
|
|
7639
|
+
scene.veil.className = "veil loading";
|
|
7640
|
+
scene.veil.style.background = "";
|
|
7641
|
+
scene.veil.style.colorScheme = scene.scheme();
|
|
7642
|
+
}
|
|
7643
|
+
function evenHole(hole) {
|
|
7644
|
+
const round3 = Math.max(...hole.radius);
|
|
7645
|
+
return { ...hole, radius: [round3, round3, round3, round3] };
|
|
7646
|
+
}
|
|
7624
7647
|
function openVeiled(scene, share) {
|
|
7625
7648
|
seen = { veil: share, content: 0, hole: scene.fullRect() };
|
|
7626
7649
|
paintVeil(scene.veil);
|
|
@@ -7702,6 +7725,8 @@ function moveHole(scene, to, time) {
|
|
|
7702
7725
|
}
|
|
7703
7726
|
function placeHole(scene, hole) {
|
|
7704
7727
|
seen.hole = hole;
|
|
7728
|
+
scene.veil.style.setProperty("--dot-x", `${hole.x + hole.width / 2}px`);
|
|
7729
|
+
scene.veil.style.setProperty("--dot-y", `${hole.y + hole.height / 2}px`);
|
|
7705
7730
|
const path3 = holePath(hole);
|
|
7706
7731
|
if (path3 === cut2)
|
|
7707
7732
|
return;
|
|
@@ -7713,7 +7738,7 @@ function track2(scene) {
|
|
|
7713
7738
|
const step = () => {
|
|
7714
7739
|
if (tracking !== frame2)
|
|
7715
7740
|
return;
|
|
7716
|
-
placeHole(scene, scene.screenRect());
|
|
7741
|
+
placeHole(scene, evenHole(scene.screenRect()));
|
|
7717
7742
|
frame2 = window.requestAnimationFrame(step);
|
|
7718
7743
|
tracking = frame2;
|
|
7719
7744
|
};
|
|
@@ -7763,7 +7788,7 @@ async function perform(scene, step, target, instant) {
|
|
|
7763
7788
|
} else if (step.kind === "layout") {
|
|
7764
7789
|
scene.layout();
|
|
7765
7790
|
} else if (step.kind === "mat") {
|
|
7766
|
-
const to = step.to === "screen" ? scene.screenRect : step.to === "round" ? () => rounded(scene.fullRect()) : scene.fullRect;
|
|
7791
|
+
const to = step.to === "screen" ? () => evenHole(scene.screenRect()) : step.to === "round" ? () => rounded(scene.fullRect()) : scene.fullRect;
|
|
7767
7792
|
const going = run;
|
|
7768
7793
|
await moveHole(scene, to, instant ? 0 : step.time);
|
|
7769
7794
|
if (step.to === "screen" && !instant && going?.live())
|
|
@@ -7780,13 +7805,16 @@ async function perform(scene, step, target, instant) {
|
|
|
7780
7805
|
}
|
|
7781
7806
|
function start(scene, target) {
|
|
7782
7807
|
if (!clipped) {
|
|
7783
|
-
seen = { veil: 1, content: 1, hole: scene.screenRect() };
|
|
7784
|
-
|
|
7808
|
+
seen = { veil: 1, content: 1, hole: evenHole(scene.screenRect()) };
|
|
7809
|
+
if (target === "closed")
|
|
7810
|
+
paintVeil(scene.veil);
|
|
7785
7811
|
scene.veil.style.opacity = "1";
|
|
7786
7812
|
cut2 = "";
|
|
7787
7813
|
placeHole(scene, seen.hole);
|
|
7788
7814
|
clipped = true;
|
|
7789
7815
|
}
|
|
7816
|
+
if (target === "open")
|
|
7817
|
+
paintCover(scene);
|
|
7790
7818
|
const shown3 = { ...seen, covered: scene.covered(), open: sameHole(seen.hole, scene.fullRect()) };
|
|
7791
7819
|
const next = sequence(plan(shown3, target), target);
|
|
7792
7820
|
run = next;
|
|
@@ -8064,8 +8092,6 @@ function explain(box2, refusal, again) {
|
|
|
8064
8092
|
};
|
|
8065
8093
|
button.addEventListener("click", run2);
|
|
8066
8094
|
why.append(button);
|
|
8067
|
-
if (retry.now)
|
|
8068
|
-
run2();
|
|
8069
8095
|
}
|
|
8070
8096
|
}
|
|
8071
8097
|
|
|
@@ -8456,8 +8482,45 @@ var VIEWPORT_CSS = `
|
|
|
8456
8482
|
top: 0;
|
|
8457
8483
|
left: 0;
|
|
8458
8484
|
}
|
|
8485
|
+
/* Holds the cover over the frame. */
|
|
8486
|
+
.page { position: relative; }
|
|
8459
8487
|
/* Where a phone's browser leaves the page in its screen. */
|
|
8460
8488
|
.page.placed { position: absolute; }
|
|
8489
|
+
/* Over the frame while its page loads or a host loads it again, so a browser's
|
|
8490
|
+
error page never flashes: the frame's own canvas, a dot that breathes. */
|
|
8491
|
+
.loading {
|
|
8492
|
+
position: absolute;
|
|
8493
|
+
inset: 0;
|
|
8494
|
+
display: flex;
|
|
8495
|
+
align-items: center;
|
|
8496
|
+
justify-content: center;
|
|
8497
|
+
background: Canvas;
|
|
8498
|
+
color: CanvasText;
|
|
8499
|
+
/* The user's own scheme, unless the knob forces one. */
|
|
8500
|
+
color-scheme: light dark;
|
|
8501
|
+
pointer-events: none;
|
|
8502
|
+
}
|
|
8503
|
+
.loading[hidden] { display: none; }
|
|
8504
|
+
/* The veil wears the cover between two devices, its dot in the mat's opening. */
|
|
8505
|
+
.veil.loading::after {
|
|
8506
|
+
position: absolute;
|
|
8507
|
+
left: var(--dot-x, 50%);
|
|
8508
|
+
top: var(--dot-y, 50%);
|
|
8509
|
+
translate: -50% -50%;
|
|
8510
|
+
}
|
|
8511
|
+
.loading::after {
|
|
8512
|
+
content: "";
|
|
8513
|
+
width: 6px;
|
|
8514
|
+
height: 6px;
|
|
8515
|
+
border-radius: 50%;
|
|
8516
|
+
background: currentColor;
|
|
8517
|
+
opacity: 0.25;
|
|
8518
|
+
animation: devknobs-breathe 1.2s ease-in-out infinite alternate;
|
|
8519
|
+
}
|
|
8520
|
+
@keyframes devknobs-breathe { to { opacity: 0.08; } }
|
|
8521
|
+
@media (prefers-reduced-motion: reduce) {
|
|
8522
|
+
.loading::after { animation: none; }
|
|
8523
|
+
}
|
|
8461
8524
|
iframe {
|
|
8462
8525
|
display: block;
|
|
8463
8526
|
border: 0;
|
|
@@ -8593,7 +8656,14 @@ var notice = null;
|
|
|
8593
8656
|
var exit2 = null;
|
|
8594
8657
|
var askWhy = null;
|
|
8595
8658
|
var framed = null;
|
|
8659
|
+
var loader = null;
|
|
8660
|
+
var ANSWER_WAIT = 6000;
|
|
8596
8661
|
var refusals = 0;
|
|
8662
|
+
var loadCover = null;
|
|
8663
|
+
var coverPoll = 0;
|
|
8664
|
+
var coverCap = 0;
|
|
8665
|
+
var COVER_POLL = 50;
|
|
8666
|
+
var COVER_CAP = ANSWER_WAIT + 2000;
|
|
8597
8667
|
var current = {
|
|
8598
8668
|
...UNFRAMED,
|
|
8599
8669
|
scheme: "system",
|
|
@@ -8652,16 +8722,78 @@ function onRefused(handler) {
|
|
|
8652
8722
|
function onFramed(handler) {
|
|
8653
8723
|
framed = handler;
|
|
8654
8724
|
}
|
|
8725
|
+
function onLoader(handler) {
|
|
8726
|
+
loader = handler;
|
|
8727
|
+
}
|
|
8728
|
+
function navigate(target, url) {
|
|
8729
|
+
if (!loader?.(target, url))
|
|
8730
|
+
target.src = url;
|
|
8731
|
+
}
|
|
8655
8732
|
function whyRefused() {
|
|
8656
8733
|
const box2 = notice;
|
|
8657
8734
|
const turn2 = ++refusals;
|
|
8658
8735
|
if (!box2)
|
|
8659
8736
|
return;
|
|
8660
8737
|
explain(box2, null, loadAgain);
|
|
8661
|
-
askWhy
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8738
|
+
if (!askWhy) {
|
|
8739
|
+
hideCover();
|
|
8740
|
+
box2.hidden = false;
|
|
8741
|
+
return;
|
|
8742
|
+
}
|
|
8743
|
+
showCover();
|
|
8744
|
+
const still2 = () => turn2 === refusals && notice === box2;
|
|
8745
|
+
let answered = false;
|
|
8746
|
+
const show2 = (refusal) => {
|
|
8747
|
+
if (!still2())
|
|
8748
|
+
return;
|
|
8749
|
+
hideCover();
|
|
8750
|
+
box2.hidden = false;
|
|
8751
|
+
explain(box2, refusal, loadAgain);
|
|
8752
|
+
};
|
|
8753
|
+
window.setTimeout(() => {
|
|
8754
|
+
if (!answered)
|
|
8755
|
+
show2(null);
|
|
8756
|
+
}, ANSWER_WAIT);
|
|
8757
|
+
askWhy(frameUrl).then((refusal) => {
|
|
8758
|
+
answered = true;
|
|
8759
|
+
const retry = refusal?.retry;
|
|
8760
|
+
if (!retry?.now) {
|
|
8761
|
+
show2(refusal);
|
|
8762
|
+
return;
|
|
8763
|
+
}
|
|
8764
|
+
retry.run().then(() => {
|
|
8765
|
+
if (still2())
|
|
8766
|
+
loadAgain();
|
|
8767
|
+
}, (error) => show2({ why: error instanceof Error ? error.message : String(error) }));
|
|
8768
|
+
}, () => {
|
|
8769
|
+
answered = true;
|
|
8770
|
+
show2(null);
|
|
8771
|
+
});
|
|
8772
|
+
}
|
|
8773
|
+
function readable() {
|
|
8774
|
+
const doc = frameDocument();
|
|
8775
|
+
return doc !== null && doc.URL !== "about:blank" && doc.readyState !== "loading";
|
|
8776
|
+
}
|
|
8777
|
+
function showCover() {
|
|
8778
|
+
if (!loadCover)
|
|
8779
|
+
return;
|
|
8780
|
+
clearTimeout(coverPoll);
|
|
8781
|
+
clearTimeout(coverCap);
|
|
8782
|
+
loadCover.hidden = false;
|
|
8783
|
+
const look = () => {
|
|
8784
|
+
if (readable())
|
|
8785
|
+
hideCover();
|
|
8786
|
+
else
|
|
8787
|
+
coverPoll = window.setTimeout(look, COVER_POLL);
|
|
8788
|
+
};
|
|
8789
|
+
coverPoll = window.setTimeout(look, COVER_POLL);
|
|
8790
|
+
coverCap = window.setTimeout(hideCover, COVER_CAP);
|
|
8791
|
+
}
|
|
8792
|
+
function hideCover() {
|
|
8793
|
+
clearTimeout(coverPoll);
|
|
8794
|
+
clearTimeout(coverCap);
|
|
8795
|
+
if (loadCover)
|
|
8796
|
+
loadCover.hidden = true;
|
|
8665
8797
|
}
|
|
8666
8798
|
function loadAgain() {
|
|
8667
8799
|
if (!frame3)
|
|
@@ -8671,7 +8803,8 @@ function loadAgain() {
|
|
|
8671
8803
|
refusals += 1;
|
|
8672
8804
|
if (notice)
|
|
8673
8805
|
notice.hidden = true;
|
|
8674
|
-
|
|
8806
|
+
showCover();
|
|
8807
|
+
navigate(frame3, frameUrl);
|
|
8675
8808
|
}
|
|
8676
8809
|
function onZoom(handler) {
|
|
8677
8810
|
zoomTo = handler;
|
|
@@ -8693,9 +8826,13 @@ function onLoad() {
|
|
|
8693
8826
|
loadedAt = performance.now();
|
|
8694
8827
|
const doc = frameDocument();
|
|
8695
8828
|
if (notice)
|
|
8696
|
-
notice.hidden =
|
|
8829
|
+
notice.hidden = true;
|
|
8697
8830
|
if (doc === null)
|
|
8698
8831
|
whyRefused();
|
|
8832
|
+
else {
|
|
8833
|
+
refusals += 1;
|
|
8834
|
+
hideCover();
|
|
8835
|
+
}
|
|
8699
8836
|
locate();
|
|
8700
8837
|
const view = frameWindow();
|
|
8701
8838
|
if (view && doc) {
|
|
@@ -8881,16 +9018,13 @@ function showMock(mock, place2) {
|
|
|
8881
9018
|
mockDrawing = mock ? drawMock(mock, place2, href) : null;
|
|
8882
9019
|
if (mockDrawing)
|
|
8883
9020
|
screen.append(mockDrawing);
|
|
8884
|
-
glass.className = mock ?
|
|
9021
|
+
glass.className = mock ? "glass mocked" : "glass";
|
|
8885
9022
|
}
|
|
8886
9023
|
const zoom = place2.zoom;
|
|
8887
9024
|
glass.style.left = mock ? `${mock.inset.left * zoom}px` : "";
|
|
8888
9025
|
glass.style.top = mock ? `${mock.inset.top * zoom}px` : "";
|
|
8889
9026
|
const round4 = mock ? corners(mock.screenRadius).map((radius) => `${radius * zoom}px`) : [];
|
|
8890
9027
|
glass.style.borderRadius = round4.join(" ");
|
|
8891
|
-
const [corner = 0] = mock ? corners(mock.screenRadius) : [];
|
|
8892
|
-
const continuous = mock?.continuous ? `${corner * CONTINUOUS.extent * zoom}px` : "";
|
|
8893
|
-
glass.style.setProperty("--continuous", continuous);
|
|
8894
9028
|
glass.style.boxShadow = href ? `0 0 0 ${UNDER * zoom}px #000` : "";
|
|
8895
9029
|
if (mock && mockDrawing) {
|
|
8896
9030
|
mockDrawing.style.width = `${mock.width * zoom}px`;
|
|
@@ -8982,6 +9116,10 @@ function resize() {
|
|
|
8982
9116
|
frame3.style.colorScheme = current.scheme;
|
|
8983
9117
|
else
|
|
8984
9118
|
frame3.style.removeProperty("color-scheme");
|
|
9119
|
+
if (loadCover)
|
|
9120
|
+
loadCover.style.colorScheme = coverScheme();
|
|
9121
|
+
if (veil?.className === "veil loading")
|
|
9122
|
+
veil.style.colorScheme = coverScheme();
|
|
8985
9123
|
frame3.style.filter = visionFilter(current.vision);
|
|
8986
9124
|
checkZoom();
|
|
8987
9125
|
warmFold();
|
|
@@ -9214,6 +9352,9 @@ function handBack() {
|
|
|
9214
9352
|
showPage();
|
|
9215
9353
|
window.scrollTo({ left: scroll.x, top: scroll.y, behavior: "instant" });
|
|
9216
9354
|
}
|
|
9355
|
+
function coverScheme() {
|
|
9356
|
+
return current.scheme === "system" ? "" : current.scheme;
|
|
9357
|
+
}
|
|
9217
9358
|
function scene() {
|
|
9218
9359
|
if (!host || !back || !veil)
|
|
9219
9360
|
return null;
|
|
@@ -9223,6 +9364,7 @@ function scene() {
|
|
|
9223
9364
|
content: contentNodes,
|
|
9224
9365
|
screenRect,
|
|
9225
9366
|
fullRect,
|
|
9367
|
+
scheme: coverScheme,
|
|
9226
9368
|
covered: () => covered,
|
|
9227
9369
|
hidePage,
|
|
9228
9370
|
painted,
|
|
@@ -9313,12 +9455,12 @@ function open(veiled, first) {
|
|
|
9313
9455
|
waiting2.then(() => {
|
|
9314
9456
|
if (frame3 !== opened)
|
|
9315
9457
|
return;
|
|
9316
|
-
opened.src = frameUrl;
|
|
9317
9458
|
opened.addEventListener("load", onLoad);
|
|
9459
|
+
navigate(opened, frameUrl);
|
|
9318
9460
|
});
|
|
9319
|
-
} else {
|
|
9320
|
-
frame3.src = frameUrl;
|
|
9461
|
+
} else if (!loader) {
|
|
9321
9462
|
frame3.addEventListener("load", onLoad);
|
|
9463
|
+
navigate(frame3, frameUrl);
|
|
9322
9464
|
}
|
|
9323
9465
|
track({
|
|
9324
9466
|
view: frameWindow,
|
|
@@ -9329,7 +9471,11 @@ function open(veiled, first) {
|
|
|
9329
9471
|
notice = createNotice(() => exit2?.());
|
|
9330
9472
|
pageBox = document.createElement("div");
|
|
9331
9473
|
pageBox.className = "page";
|
|
9332
|
-
|
|
9474
|
+
loadCover = document.createElement("div");
|
|
9475
|
+
loadCover.className = "loading";
|
|
9476
|
+
loadCover.setAttribute("aria-hidden", "true");
|
|
9477
|
+
pageBox.append(frame3, loadCover);
|
|
9478
|
+
showCover();
|
|
9333
9479
|
glass.append(pageBox);
|
|
9334
9480
|
browser = createBrowser(glass, frame3, resize, onReloading, painted);
|
|
9335
9481
|
touchDot = createTouchDot({
|
|
@@ -9354,6 +9500,10 @@ function open(veiled, first) {
|
|
|
9354
9500
|
window.addEventListener("resize", resize);
|
|
9355
9501
|
window.addEventListener("pagehide", keep2);
|
|
9356
9502
|
body.append(host);
|
|
9503
|
+
if (!waiting2 && loader) {
|
|
9504
|
+
frame3.addEventListener("load", onLoad);
|
|
9505
|
+
navigate(frame3, frameUrl);
|
|
9506
|
+
}
|
|
9357
9507
|
stopKeeping = keepMounted(host, { restored: remounted });
|
|
9358
9508
|
const now = scene();
|
|
9359
9509
|
if (veiled !== null && now)
|
|
@@ -9416,6 +9566,8 @@ function teardown() {
|
|
|
9416
9566
|
mockDrawing = null;
|
|
9417
9567
|
mockKey = "";
|
|
9418
9568
|
frame3 = null;
|
|
9569
|
+
hideCover();
|
|
9570
|
+
loadCover = null;
|
|
9419
9571
|
notice = null;
|
|
9420
9572
|
readout = null;
|
|
9421
9573
|
caption = null;
|
|
@@ -69,7 +69,7 @@ import {
|
|
|
69
69
|
uaPreset,
|
|
70
70
|
webStorage,
|
|
71
71
|
wrapDate
|
|
72
|
-
} from "./index-
|
|
72
|
+
} from "./index-p57fdttx.js";
|
|
73
73
|
|
|
74
74
|
// src/engine/intl.ts
|
|
75
75
|
var SERVICES = [
|
|
@@ -1134,6 +1134,7 @@ __export(exports_engine, {
|
|
|
1134
1134
|
ready: () => ready,
|
|
1135
1135
|
nativeSwitch: () => nativeSwitch,
|
|
1136
1136
|
keepPlace: () => keepPlace2,
|
|
1137
|
+
hostSendsUa: () => hostSendsUa,
|
|
1137
1138
|
getState: () => getState,
|
|
1138
1139
|
applyState: () => applyState
|
|
1139
1140
|
});
|
|
@@ -4108,7 +4109,7 @@ function pause(on3) {
|
|
|
4108
4109
|
|
|
4109
4110
|
// src/engine/frames.ts
|
|
4110
4111
|
var kit = null;
|
|
4111
|
-
var load2 = () => import("./framekit-
|
|
4112
|
+
var load2 = () => import("./framekit-yk1jxjv7.js");
|
|
4112
4113
|
var loading = null;
|
|
4113
4114
|
var down = false;
|
|
4114
4115
|
var waiting = [];
|
|
@@ -4118,12 +4119,14 @@ var exit = null;
|
|
|
4118
4119
|
var zoomTo = null;
|
|
4119
4120
|
var askWhy = null;
|
|
4120
4121
|
var framed2 = null;
|
|
4122
|
+
var loader = null;
|
|
4121
4123
|
function arrived(loaded) {
|
|
4122
4124
|
kit = loaded;
|
|
4123
4125
|
loaded.width.onExit(exit);
|
|
4124
4126
|
loaded.width.onZoom(zoomTo);
|
|
4125
4127
|
loaded.width.onRefused(askWhy);
|
|
4126
4128
|
loaded.width.onFramed(framed2);
|
|
4129
|
+
loaded.width.onLoader(loader);
|
|
4127
4130
|
for (const run of waiting.splice(0))
|
|
4128
4131
|
run(loaded);
|
|
4129
4132
|
for (const state of [before, latest]) {
|
|
@@ -4204,6 +4207,10 @@ function onFramed(handler) {
|
|
|
4204
4207
|
framed2 = handler;
|
|
4205
4208
|
kit?.width.onFramed(handler);
|
|
4206
4209
|
}
|
|
4210
|
+
function onLoader(handler) {
|
|
4211
|
+
loader = handler;
|
|
4212
|
+
kit?.width.onLoader(handler);
|
|
4213
|
+
}
|
|
4207
4214
|
function frameWindow() {
|
|
4208
4215
|
return kit?.width.frameWindow() ?? null;
|
|
4209
4216
|
}
|
|
@@ -4249,6 +4256,7 @@ var persist = true;
|
|
|
4249
4256
|
var running = false;
|
|
4250
4257
|
var native2 = null;
|
|
4251
4258
|
var nativeNote = null;
|
|
4259
|
+
var toldRealPhone = false;
|
|
4252
4260
|
var inFrame = false;
|
|
4253
4261
|
var stopRelay = null;
|
|
4254
4262
|
var panelMoving = null;
|
|
@@ -4267,6 +4275,10 @@ function driver() {
|
|
|
4267
4275
|
}
|
|
4268
4276
|
function applyState(next) {
|
|
4269
4277
|
state = inFrame ? framed(next) : next;
|
|
4278
|
+
if (running && !inFrame && native2?.realPhone && toldRealPhone !== state.panel.realPhone) {
|
|
4279
|
+
toldRealPhone = state.panel.realPhone;
|
|
4280
|
+
native2.realPhone(toldRealPhone);
|
|
4281
|
+
}
|
|
4270
4282
|
const active2 = driver();
|
|
4271
4283
|
const page = inPage(state, active2);
|
|
4272
4284
|
const scheme = inFrame && nativeScheme(page.scheme) ? "system" : page.scheme;
|
|
@@ -4299,8 +4311,8 @@ function applyState(next) {
|
|
|
4299
4311
|
else if (native2 && !inFrame)
|
|
4300
4312
|
driveUa(native2, state);
|
|
4301
4313
|
apply15(state.spacing);
|
|
4302
|
-
apply4(state.ua);
|
|
4303
4314
|
const sized2 = inFrame ? state : framing(state, active2);
|
|
4315
|
+
apply4(!inFrame && needsFrame(sized2) ? DEFAULT_STATE.ua : state.ua);
|
|
4304
4316
|
apply19(sized2);
|
|
4305
4317
|
apply13(state.overflow && !needsFrame(sized2));
|
|
4306
4318
|
apply12(state.outlines);
|
|
@@ -4321,6 +4333,9 @@ function setNative(on3, note) {
|
|
|
4321
4333
|
if (running && (changed || note !== undefined))
|
|
4322
4334
|
applyState(state);
|
|
4323
4335
|
}
|
|
4336
|
+
function hostSendsUa() {
|
|
4337
|
+
return native2?.ua !== undefined && native2.realPhone !== undefined;
|
|
4338
|
+
}
|
|
4324
4339
|
function nativeSwitch() {
|
|
4325
4340
|
if (!native2?.setting)
|
|
4326
4341
|
return null;
|
|
@@ -4389,7 +4404,10 @@ function start4(options = {}) {
|
|
|
4389
4404
|
onZoom((zoom) => setState({ zoom }));
|
|
4390
4405
|
onRefused(native2?.refused ?? null);
|
|
4391
4406
|
onFramed(native2?.framed ?? null);
|
|
4392
|
-
|
|
4407
|
+
onLoader(native2?.load ?? null);
|
|
4408
|
+
const first = merge(stored ? load() : { ...DEFAULT_STATE }, options.state ?? {});
|
|
4409
|
+
toldRealPhone = first.panel.realPhone;
|
|
4410
|
+
applyState(first);
|
|
4393
4411
|
if (!inFrame)
|
|
4394
4412
|
return;
|
|
4395
4413
|
relay(overflowCount());
|
|
@@ -4409,6 +4427,7 @@ function stop2() {
|
|
|
4409
4427
|
onZoom(null);
|
|
4410
4428
|
onRefused(null);
|
|
4411
4429
|
onFramed(null);
|
|
4430
|
+
onLoader(null);
|
|
4412
4431
|
destroy();
|
|
4413
4432
|
reset6();
|
|
4414
4433
|
reset17();
|
|
@@ -4978,4 +4997,4 @@ function glyph(name, size = 14) {
|
|
|
4978
4997
|
return isBrand(name) ? brand(name, size) : icon(name, size);
|
|
4979
4998
|
}
|
|
4980
4999
|
|
|
4981
|
-
export { BODY_CAP, READ_MS, requestLog, sends, canonicalTag, LOCALE_PRESETS, overflowCount, onCount, devIconShown, devIconFor, SPEED_MIN, SPEED_MAX, TIME_ZONE_PRESETS, canonicalZone, resolveTimeZone, composedParent, isDevknobs, isGrabbable, grabTargetAt, LAYER, HOST_RESET, holdInTopLayer, pause, frameWindow, panelSized, zoomKey, landSplash, takeHinge, moveHinge, letGo, holdingHinge, foldRest, watchFold, watchHinge, getState, subscribe, setNative, nativeSwitch, setState, ready, watchPanel, keepPlace2 as keepPlace, reset19 as reset, start4 as start, stop2 as stop, replay2 as replay, exports_engine, parseCombo, comboText, withShift, isFunctionKey, comboLabel, comboSpoken, defaultKeys, KEYS_FIELD, typesInField, lowerKey, keyIs, keyAction, isSearchKey, typeAhead, zoomAction, escapeStep, highlightAt, paletteMove, radioMove, forwardKeys, ROW_ICONS, rowIcon, BINDING_ICONS, icon, glyph };
|
|
5000
|
+
export { BODY_CAP, READ_MS, requestLog, sends, canonicalTag, LOCALE_PRESETS, overflowCount, onCount, devIconShown, devIconFor, SPEED_MIN, SPEED_MAX, TIME_ZONE_PRESETS, canonicalZone, resolveTimeZone, composedParent, isDevknobs, isGrabbable, grabTargetAt, LAYER, HOST_RESET, holdInTopLayer, pause, frameWindow, panelSized, zoomKey, landSplash, takeHinge, moveHinge, letGo, holdingHinge, foldRest, watchFold, watchHinge, getState, subscribe, setNative, hostSendsUa, nativeSwitch, setState, ready, watchPanel, keepPlace2 as keepPlace, reset19 as reset, start4 as start, stop2 as stop, replay2 as replay, exports_engine, parseCombo, comboText, withShift, isFunctionKey, comboLabel, comboSpoken, defaultKeys, KEYS_FIELD, typesInField, lowerKey, keyIs, keyAction, isSearchKey, typeAhead, zoomAction, escapeStep, highlightAt, paletteMove, radioMove, forwardKeys, ROW_ICONS, rowIcon, BINDING_ICONS, icon, glyph };
|