@vinena/knobs 0.7.0 → 0.7.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 +23 -0
- package/README.md +2 -2
- package/dist/cli.js +2 -2
- package/dist/{context-eawqn680.js → context-2r76ext7.js} +3 -3
- package/dist/{context-vd2xep5t.js → context-h1bdt8w3.js} +3 -3
- package/dist/early.global.js +7 -8
- package/dist/edit/html.d.ts +7 -3
- package/dist/edit/keep.d.ts +1 -1
- package/dist/{elementsview-m33ejs4r.js → elementsview-1bar694x.js} +21 -19
- package/dist/{elementsview-jg4edt86.js → elementsview-p2wc9b0s.js} +21 -19
- package/dist/engine/bandmedia.d.ts +119 -0
- package/dist/engine/bezels.d.ts +2 -2
- package/dist/engine/browserui.d.ts +3 -1
- package/dist/engine/check.d.ts +2 -2
- package/dist/engine/describe.d.ts +2 -2
- package/dist/engine/devices.d.ts +3 -3
- package/dist/engine/fit.d.ts +4 -4
- package/dist/engine/foldhand.d.ts +2 -2
- package/dist/engine/frame.d.ts +6 -6
- package/dist/engine/frames.d.ts +4 -4
- package/dist/engine/fresh.d.ts +12 -5
- package/dist/engine/header.d.ts +3 -1
- package/dist/engine/identity.d.ts +4 -4
- package/dist/engine/index.d.ts +7 -7
- package/dist/engine/locale.d.ts +2 -2
- package/dist/engine/morph.d.ts +2 -2
- package/dist/engine/native.d.ts +8 -8
- package/dist/engine/pageshot.d.ts +24 -4
- package/dist/engine/placeholder.d.ts +3 -3
- package/dist/engine/reload.d.ts +2 -2
- package/dist/engine/safaridraw.d.ts +24 -3
- package/dist/engine/screen.d.ts +2 -2
- package/dist/engine/scrollkeep.d.ts +1 -1
- package/dist/engine/store.d.ts +11 -11
- package/dist/engine/storekeys.d.ts +34 -0
- package/dist/engine/style.d.ts +1 -1
- package/dist/engine/tabicon.d.ts +2 -2
- package/dist/engine/underbar.d.ts +26 -7
- package/dist/engine/underneath.d.ts +1 -0
- package/dist/engine/width.d.ts +3 -3
- package/dist/{framekit-r16k97n7.js → framekit-n57ts9zt.js} +959 -87
- package/dist/{framekit-40pzennw.js → framekit-wqp811a2.js} +959 -87
- package/dist/grab/clipboard.d.ts +2 -0
- package/dist/{index-jfv7vavj.js → index-311fys81.js} +93 -29
- package/dist/index-3dcgysws.js +77 -0
- package/dist/{index-ztnjefrh.js → index-585hs9tp.js} +5 -1
- package/dist/{index-za4ppxay.js → index-6t0w5s7p.js} +1 -1
- package/dist/{index-tqq2ygpj.js → index-9targr2f.js} +26 -16
- package/dist/{index-t4kssacm.js → index-abwqw8jh.js} +6 -1
- package/dist/{index-s6yzsvs4.js → index-b8cnnbpr.js} +25 -18
- package/dist/{index-xxbb8y41.js → index-cfrnrg24.js} +20 -14
- package/dist/{index-v2v4rmpe.js → index-dvtbh3c8.js} +24 -18
- package/dist/{index-0qkj2mgb.js → index-j8hrzag1.js} +14 -11
- package/dist/{index-cb91vcka.js → index-k4w5v53q.js} +1 -1
- package/dist/{index-q53j8wg5.js → index-n31pn4ax.js} +19 -15
- package/dist/{index-s6fya8pm.js → index-pvknvvkw.js} +11 -10
- package/dist/{index-3nwycv3p.js → index-qz04adp5.js} +20 -14
- package/dist/{index-ymqm185m.js → index-rps0bdq9.js} +1 -1
- package/dist/{index-a8ffw5ft.js → index-szd9bddn.js} +1 -1
- package/dist/{index-8d1yk9d2.js → index-t7a07nm9.js} +59 -39
- package/dist/{index-2jc9dnta.js → index-vhda420r.js} +11 -5
- package/dist/{index-xs29b55n.js → index-vmprrfwe.js} +5 -2
- package/dist/{index-fjrrgd9h.js → index-vmz7htwn.js} +1 -1
- package/dist/index.d.ts +14 -8
- package/dist/index.global.js +182 -165
- package/dist/index.js +57 -32
- package/dist/instance.d.ts +7 -1
- package/dist/mark.d.ts +50 -0
- package/dist/{react-vvc4x9kq.js → react-0tbd51s3.js} +14 -11
- package/dist/{react-0gxs9aef.js → react-4ezjf7mq.js} +24 -18
- package/dist/react-4qn9vsjw.js +78 -0
- package/dist/{react-73reavv4.js → react-4tcwpama.js} +1 -1
- package/dist/{react-6ngtb6p9.js → react-7eyps0cg.js} +1 -1
- package/dist/{react-zp7fdw8e.js → react-881wvm1z.js} +59 -39
- package/dist/{react-yx3g9k55.js → react-amvrbng8.js} +5 -2
- package/dist/{react-5rq7bnsy.js → react-atw9y8ny.js} +5 -1
- package/dist/{react-4phtr2nd.js → react-dg4bjv3j.js} +1 -1
- package/dist/{react-meve34wp.js → react-hdneb4v3.js} +11 -5
- package/dist/{react-h9w04skh.js → react-j87bdhhe.js} +4 -1
- package/dist/{react-wtgvkf6g.js → react-mkafgzqf.js} +1 -1
- package/dist/{react-fq4551ks.js → react-pf7fc2f3.js} +11 -10
- package/dist/{react-0r5418av.js → react-rbmk30xk.js} +92 -29
- package/dist/{react-actmnkwp.js → react-rxw73n04.js} +1 -1
- package/dist/{react-8nmtt0ge.js → react-w94cfn87.js} +19 -15
- package/dist/{react-3ev6rwqz.js → react-x209et38.js} +26 -16
- package/dist/{react-5h7pxnax.js → react-zj0dbpdg.js} +25 -18
- package/dist/react.d.ts +3 -1
- package/dist/react.js +60 -33
- package/dist/{replay-pmesjfa3.js → replay-3xqgt3xg.js} +8 -8
- package/dist/{replay-m5g8km9y.js → replay-48gn27bj.js} +8 -8
- package/dist/storage/onload.d.ts +1 -1
- package/dist/{storageview-9a6zm47z.js → storageview-5tvmca8y.js} +16 -13
- package/dist/{storageview-x62v1c3j.js → storageview-ec52x60p.js} +16 -13
- package/dist/styles/force.d.ts +3 -1
- package/dist/types.d.ts +4 -4
- package/dist/ui/actions.d.ts +3 -3
- package/dist/ui/bindings.d.ts +1 -1
- package/dist/ui/catalog.d.ts +14 -14
- package/dist/ui/changes.d.ts +1 -1
- package/dist/ui/colors.d.ts +1 -1
- package/dist/ui/deviceknobs.d.ts +2 -2
- package/dist/ui/editors.d.ts +3 -3
- package/dist/ui/foldslider.d.ts +2 -2
- package/dist/ui/keys.d.ts +1 -1
- package/dist/ui/list.d.ts +10 -10
- package/dist/ui/palette.d.ts +2 -2
- package/dist/ui/pin.d.ts +2 -2
- package/dist/ui/prefs.d.ts +1 -1
- package/dist/ui/rows.d.ts +3 -3
- package/dist/ui/storageview.d.ts +2 -2
- package/dist/ui/stylesview.d.ts +3 -3
- package/dist/ui/swatches.d.ts +2 -2
- package/package.json +2 -1
- package/skills/knobs/SKILL.md +36 -35
- package/dist/index-5tv6sr74.js +0 -23
- package/dist/react-t2qnewz2.js +0 -24
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
turnOf,
|
|
26
26
|
turnedPose,
|
|
27
27
|
windowRect
|
|
28
|
-
} from "./react-
|
|
28
|
+
} from "./react-7eyps0cg.js";
|
|
29
29
|
import {
|
|
30
30
|
hush,
|
|
31
31
|
hushOnce,
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
} from "./react-97b5b8j4.js";
|
|
40
40
|
import {
|
|
41
41
|
copyText
|
|
42
|
-
} from "./react-
|
|
42
|
+
} from "./react-j87bdhhe.js";
|
|
43
43
|
import {
|
|
44
44
|
BARS_START,
|
|
45
45
|
DOT_LOOK,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
uaPreset,
|
|
84
84
|
userAgentOf,
|
|
85
85
|
viewportOf
|
|
86
|
-
} from "./react-
|
|
86
|
+
} from "./react-zj0dbpdg.js";
|
|
87
87
|
import {
|
|
88
88
|
FRAME_ATTRIBUTE,
|
|
89
89
|
FRAME_NAME,
|
|
@@ -125,11 +125,16 @@ import {
|
|
|
125
125
|
turn,
|
|
126
126
|
walkRules,
|
|
127
127
|
wheelZoom
|
|
128
|
-
} from "./react-
|
|
128
|
+
} from "./react-rbmk30xk.js";
|
|
129
129
|
import"./react-fp73vhyd.js";
|
|
130
130
|
import {
|
|
131
|
-
__export
|
|
132
|
-
|
|
131
|
+
__export,
|
|
132
|
+
findOwn,
|
|
133
|
+
isMarked,
|
|
134
|
+
markOwn,
|
|
135
|
+
ownSelector,
|
|
136
|
+
setMark
|
|
137
|
+
} from "./react-4qn9vsjw.js";
|
|
133
138
|
|
|
134
139
|
// src/engine/width.ts
|
|
135
140
|
var exports_width = {};
|
|
@@ -3673,6 +3678,7 @@ function buildChrome(full, mini, look) {
|
|
|
3673
3678
|
|
|
3674
3679
|
// src/engine/safaridraw.ts
|
|
3675
3680
|
var DOMAIN_WEIGHT = 500;
|
|
3681
|
+
var DOMAIN_PAD = 0.15;
|
|
3676
3682
|
var SAFARI_CSS = `
|
|
3677
3683
|
.safari {
|
|
3678
3684
|
color: #000;
|
|
@@ -3741,14 +3747,27 @@ var SAFARI_CSS = `
|
|
|
3741
3747
|
.safari .glyph.off { stroke-opacity: 0.3; fill-opacity: 0.3; }
|
|
3742
3748
|
.safari .domain {
|
|
3743
3749
|
left: 50%;
|
|
3750
|
+
/* A host that does not fit keeps its end and loses its start, never to an ellipsis. */
|
|
3751
|
+
display: flex;
|
|
3752
|
+
justify-content: flex-end;
|
|
3744
3753
|
white-space: nowrap;
|
|
3745
3754
|
overflow: hidden;
|
|
3746
|
-
text-overflow: ellipsis;
|
|
3747
|
-
text-align: center;
|
|
3748
3755
|
font-size: ${SAFARI_TEXT.field}px;
|
|
3749
3756
|
font-weight: ${DOMAIN_WEIGHT};
|
|
3757
|
+
/* Its box is one line high, less than the font's ascent and descent: padded the same above and below, a g's tail is drawn whole and the baseline stays. */
|
|
3758
|
+
padding-block: ${DOMAIN_PAD}em;
|
|
3750
3759
|
transform: translate(-50%, -50%);
|
|
3751
|
-
|
|
3760
|
+
/* Its start fades over 9 px where it is cut; where it fits, the fade slides out past the start. */
|
|
3761
|
+
-webkit-mask-image: linear-gradient(to right, transparent, #000 9px);
|
|
3762
|
+
mask-image: linear-gradient(to right, transparent, #000 9px);
|
|
3763
|
+
-webkit-mask-size: calc(100% + 9px) 100%;
|
|
3764
|
+
mask-size: calc(100% + 9px) 100%;
|
|
3765
|
+
-webkit-mask-repeat: no-repeat;
|
|
3766
|
+
mask-repeat: no-repeat;
|
|
3767
|
+
-webkit-mask-position: -9px 0;
|
|
3768
|
+
mask-position: -9px 0;
|
|
3769
|
+
}
|
|
3770
|
+
.safari .domain[data-cut="true"] { -webkit-mask-position: 0 0; mask-position: 0 0; }
|
|
3752
3771
|
.safari .time { font-weight: 600; transform: translate(-50%, -50%); }
|
|
3753
3772
|
.safari .status { fill: currentColor; }
|
|
3754
3773
|
/* The battery's uncharged rest: #b2b2b2 on white, #808080 on black. */
|
|
@@ -3773,7 +3792,10 @@ var SAFARI_CSS = `
|
|
|
3773
3792
|
transition:
|
|
3774
3793
|
top var(--main) ${MORPH.ease},
|
|
3775
3794
|
height var(--main) ${MORPH.ease},
|
|
3776
|
-
transform var(--main) ${MORPH.ease}
|
|
3795
|
+
transform var(--main) ${MORPH.ease},
|
|
3796
|
+
max-width var(--main) ${MORPH.ease},
|
|
3797
|
+
-webkit-mask-position var(--main) ${MORPH.ease},
|
|
3798
|
+
mask-position var(--main) ${MORPH.ease};
|
|
3777
3799
|
}
|
|
3778
3800
|
/* The parts only the expanded bars have: an icon swap, out early, in late. */
|
|
3779
3801
|
.safari .full {
|
|
@@ -4041,19 +4063,59 @@ function pressOf(glyph, actions) {
|
|
|
4041
4063
|
return actions.reload;
|
|
4042
4064
|
return;
|
|
4043
4065
|
}
|
|
4066
|
+
var GLYPH_BOX = 30;
|
|
4044
4067
|
function glyphIn(mark, origin, className, actions) {
|
|
4045
|
-
const svg = glyphAt(mark, GLYPHS2,
|
|
4046
|
-
svg.style.left = `${mark.x - origin.x -
|
|
4047
|
-
svg.style.top = `${mark.y - origin.y -
|
|
4068
|
+
const svg = glyphAt(mark, GLYPHS2, GLYPH_BOX, className, pressOf(mark.glyph, actions));
|
|
4069
|
+
svg.style.left = `${mark.x - origin.x - GLYPH_BOX / 2}px`;
|
|
4070
|
+
svg.style.top = `${mark.y - origin.y - GLYPH_BOX / 2}px`;
|
|
4048
4071
|
return svg;
|
|
4049
4072
|
}
|
|
4050
4073
|
function domainOf(host) {
|
|
4051
4074
|
return host.replace(/:\d+$/, "");
|
|
4052
4075
|
}
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4076
|
+
var PILL_MARGIN = 16;
|
|
4077
|
+
var MARK_CLEAR = 21;
|
|
4078
|
+
var FIELD_LEAST = 13;
|
|
4079
|
+
var FIT_STEPS = 6;
|
|
4080
|
+
var FIT_SLACK = 0.5;
|
|
4081
|
+
function domainRoom(shape, host, width) {
|
|
4082
|
+
const middle = shape.text?.x ?? shape.x + shape.width / 2;
|
|
4083
|
+
if (shape.kind === "pill") {
|
|
4084
|
+
const text = Math.ceil(textWidth(domainOf(host), shape.text?.size ?? SAFARI_TEXT.pill, DOMAIN_WEIGHT));
|
|
4085
|
+
const most = 2 * (Math.min(middle, width - middle) - PILL_MARGIN) - (shape.text?.pad ?? 0);
|
|
4086
|
+
return Math.max(0, Math.min(text, most));
|
|
4087
|
+
}
|
|
4088
|
+
let half = shape.width / 2;
|
|
4089
|
+
for (const { x } of shape.marks) {
|
|
4090
|
+
half = Math.min(half, Math.abs(x - middle) - (shape.text?.clear ?? MARK_CLEAR));
|
|
4091
|
+
}
|
|
4092
|
+
return Math.max(0, 2 * half);
|
|
4093
|
+
}
|
|
4094
|
+
function domainFit(shape, host, width) {
|
|
4095
|
+
const room = domainRoom(shape, host, width);
|
|
4096
|
+
const text = domainOf(host);
|
|
4097
|
+
if (shape.kind === "pill") {
|
|
4098
|
+
const size2 = shape.text?.size ?? SAFARI_TEXT.pill;
|
|
4099
|
+
return { size: size2, room, cut: room < textWidth(text, size2, DOMAIN_WEIGHT) };
|
|
4100
|
+
}
|
|
4101
|
+
let size = shape.text?.size ?? SAFARI_TEXT.field;
|
|
4102
|
+
for (let step = 0;step < FIT_STEPS && size > FIELD_LEAST; step++) {
|
|
4103
|
+
const advance = textWidth(text, size, DOMAIN_WEIGHT);
|
|
4104
|
+
if (advance <= room + FIT_SLACK)
|
|
4105
|
+
break;
|
|
4106
|
+
size = Math.max(FIELD_LEAST, size * room / advance);
|
|
4107
|
+
}
|
|
4108
|
+
return { size, room, cut: textWidth(text, size, DOMAIN_WEIGHT) > room + FIT_SLACK };
|
|
4109
|
+
}
|
|
4110
|
+
function pillBox(pill, host, width) {
|
|
4111
|
+
const box2 = domainRoom(pill, host, width) + (pill.text?.pad ?? 0);
|
|
4112
|
+
return { x: pill.x - box2 / 2, y: pill.y, width: box2, height: pill.height };
|
|
4113
|
+
}
|
|
4114
|
+
function drawnScale(node) {
|
|
4115
|
+
if (typeof getComputedStyle !== "function")
|
|
4116
|
+
return 1;
|
|
4117
|
+
const scale = /^matrix\(([^,]+),/.exec(getComputedStyle(node).transform)?.[1];
|
|
4118
|
+
return Number(scale) || 1;
|
|
4057
4119
|
}
|
|
4058
4120
|
function hslOf({ red, green, blue }) {
|
|
4059
4121
|
const [r, g, b] = [red / 255, green / 255, blue / 255];
|
|
@@ -4180,14 +4242,16 @@ function buildSafari(full, mini, look, actions) {
|
|
|
4180
4242
|
const main = pill ? full.shapes.find((shape) => shape.kind === "card") ?? full.shapes.find((shape) => shape.text !== undefined) ?? null : null;
|
|
4181
4243
|
let surface = null;
|
|
4182
4244
|
let domain = null;
|
|
4245
|
+
const screen = turn(full.screen, full.orientation).width;
|
|
4246
|
+
const texts = [];
|
|
4183
4247
|
const glyphs = [];
|
|
4184
4248
|
const keep2 = (node, glyph) => {
|
|
4185
4249
|
glyphs.push({ node, glyph });
|
|
4186
4250
|
return node;
|
|
4187
4251
|
};
|
|
4252
|
+
const field = full.shapes.find((shape) => shape.kind === "field");
|
|
4188
4253
|
if (main && pill) {
|
|
4189
4254
|
surface = el("div", main.kind === "card" ? "surface from-card" : "surface");
|
|
4190
|
-
const field = full.shapes.find((shape) => shape.kind === "field");
|
|
4191
4255
|
if (field) {
|
|
4192
4256
|
const inner = el("div", "field full");
|
|
4193
4257
|
placeBox(inner, { ...field, x: field.x - main.x, y: field.y - main.y }, field.radius);
|
|
@@ -4208,7 +4272,6 @@ function buildSafari(full, mini, look, actions) {
|
|
|
4208
4272
|
}
|
|
4209
4273
|
domain = el("div", "domain");
|
|
4210
4274
|
const text = (field ?? main).text;
|
|
4211
|
-
domain.style.maxWidth = `${(field ?? main).width - 96}px`;
|
|
4212
4275
|
domain.dataset.top = String((text?.y ?? main.y) - main.y);
|
|
4213
4276
|
surface.append(domain);
|
|
4214
4277
|
const expand = actions.expand;
|
|
@@ -4244,7 +4307,7 @@ function buildSafari(full, mini, look, actions) {
|
|
|
4244
4307
|
if (shape.text) {
|
|
4245
4308
|
const text = el("div", "domain");
|
|
4246
4309
|
text.style.top = `${shape.text.y - shape.y}px`;
|
|
4247
|
-
|
|
4310
|
+
texts.push({ node: text, shape });
|
|
4248
4311
|
side.append(text);
|
|
4249
4312
|
}
|
|
4250
4313
|
root.append(side);
|
|
@@ -4263,6 +4326,12 @@ function buildSafari(full, mini, look, actions) {
|
|
|
4263
4326
|
for (const text of Array.from(root.querySelectorAll(".domain"))) {
|
|
4264
4327
|
text.textContent = domainOf(sight.host);
|
|
4265
4328
|
}
|
|
4329
|
+
for (const { node, shape } of texts) {
|
|
4330
|
+
const fit = domainFit(shape, sight.host, screen);
|
|
4331
|
+
node.style.fontSize = `${fit.size}px`;
|
|
4332
|
+
node.style.maxWidth = `${fit.room}px`;
|
|
4333
|
+
node.dataset.cut = String(fit.cut);
|
|
4334
|
+
}
|
|
4266
4335
|
for (const { node, box: box2 } of sides)
|
|
4267
4336
|
tintGlass(node, box2, sight);
|
|
4268
4337
|
for (const { node, glyph } of glyphs) {
|
|
@@ -4271,13 +4340,33 @@ function buildSafari(full, mini, look, actions) {
|
|
|
4271
4340
|
node.classList.toggle("press", !off && pressOf(glyph, actions) !== undefined);
|
|
4272
4341
|
}
|
|
4273
4342
|
if (surface && domain && main && pill) {
|
|
4274
|
-
const box2 = minimized ? pillBox(pill, sight.host) : main;
|
|
4343
|
+
const box2 = minimized ? pillBox(pill, sight.host, screen) : main;
|
|
4275
4344
|
placeBox(surface, box2, minimized ? pill.radius : main.radius);
|
|
4276
4345
|
tintGlass(surface, box2, sight);
|
|
4346
|
+
const shown2 = minimized ? pill : field ?? main;
|
|
4347
|
+
const { size, room, cut } = domainFit(shown2, sight.host, screen);
|
|
4348
|
+
const was = Number(domain.dataset.size) || size;
|
|
4349
|
+
const turned = domain.dataset.min !== undefined && domain.dataset.min !== String(minimized);
|
|
4350
|
+
domain.dataset.size = String(size);
|
|
4351
|
+
domain.dataset.min = String(minimized);
|
|
4352
|
+
domain.dataset.cut = String(cut);
|
|
4353
|
+
if (turned && was !== size) {
|
|
4354
|
+
const seen = domain.getBoundingClientRect().width;
|
|
4355
|
+
const host = domainOf(sight.host);
|
|
4356
|
+
const advance = textWidth(host, was, DOMAIN_WEIGHT) / textWidth(host, size, DOMAIN_WEIGHT);
|
|
4357
|
+
const scale = drawnScale(domain) * (advance || was / size);
|
|
4358
|
+
domain.style.transitionProperty = "top, height, -webkit-mask-position, mask-position";
|
|
4359
|
+
domain.style.fontSize = `${size}px`;
|
|
4360
|
+
domain.style.transform = `translate(-50%, -50%) scale(${scale})`;
|
|
4361
|
+
domain.style.maxWidth = `${seen / scale}px`;
|
|
4362
|
+
domain.offsetWidth;
|
|
4363
|
+
domain.style.transitionProperty = "";
|
|
4364
|
+
}
|
|
4365
|
+
domain.style.fontSize = `${size}px`;
|
|
4366
|
+
domain.style.maxWidth = `${room}px`;
|
|
4277
4367
|
const top = minimized ? pill.height / 2 : Number(domain.dataset.top);
|
|
4278
4368
|
domain.style.top = `${top}px`;
|
|
4279
|
-
|
|
4280
|
-
domain.style.transform = `translate(-50%, -50%) scale(${scale})`;
|
|
4369
|
+
domain.style.transform = "translate(-50%, -50%)";
|
|
4281
4370
|
}
|
|
4282
4371
|
},
|
|
4283
4372
|
loading(on, still2) {
|
|
@@ -4759,7 +4848,8 @@ function drawMedia(pen, media, rect, style) {
|
|
|
4759
4848
|
}
|
|
4760
4849
|
if (style.imageRendering === "pixelated" || style.imageRendering === "crisp-edges")
|
|
4761
4850
|
pen.imageSmoothingEnabled = false;
|
|
4762
|
-
|
|
4851
|
+
const scale = media.scale ?? 1;
|
|
4852
|
+
pen.drawImage(media.source, from.x * scale, from.y * scale, from.width * scale, from.height * scale, to.x, to.y, to.width, to.height);
|
|
4763
4853
|
pen.restore();
|
|
4764
4854
|
}
|
|
4765
4855
|
function picturesKey(doc) {
|
|
@@ -4830,7 +4920,7 @@ function shootPage(frame2, glass, size, color, layout = "") {
|
|
|
4830
4920
|
const draw = (node, alpha, lifted) => {
|
|
4831
4921
|
if (seen++ > MOST || seen % 50 === 0 && performance.now() > deadline)
|
|
4832
4922
|
return;
|
|
4833
|
-
if (node
|
|
4923
|
+
if (isMarked(node))
|
|
4834
4924
|
return;
|
|
4835
4925
|
const style = view.getComputedStyle(node);
|
|
4836
4926
|
if (style.display === "none")
|
|
@@ -4987,7 +5077,19 @@ function blankPictures(live, copy) {
|
|
|
4987
5077
|
image.setAttribute("src", blankUrl(from.naturalWidth, from.naturalHeight));
|
|
4988
5078
|
});
|
|
4989
5079
|
}
|
|
4990
|
-
|
|
5080
|
+
var NO_CONTROLS = "video::-webkit-media-controls { display: none !important; }";
|
|
5081
|
+
function cuts(overflow) {
|
|
5082
|
+
return overflow === "hidden" || overflow === "auto" || overflow === "scroll" || overflow === "clip";
|
|
5083
|
+
}
|
|
5084
|
+
function viewportOverflow(doc, view) {
|
|
5085
|
+
const root = doc.documentElement;
|
|
5086
|
+
const style = view.getComputedStyle(root);
|
|
5087
|
+
if (cuts(style.overflowX) || cuts(style.overflowY))
|
|
5088
|
+
return root;
|
|
5089
|
+
const { body } = doc;
|
|
5090
|
+
return body?.localName === "body" && body.parentElement === root ? body : null;
|
|
5091
|
+
}
|
|
5092
|
+
function copyPage(frame2, leave, each) {
|
|
4991
5093
|
const doc = frame2.contentDocument;
|
|
4992
5094
|
if (!doc?.documentElement)
|
|
4993
5095
|
return null;
|
|
@@ -5027,7 +5129,7 @@ ${own.join(`
|
|
|
5027
5129
|
const inert = doc.implementation.createHTMLDocument("");
|
|
5028
5130
|
const root = inert.importNode(doc.documentElement, true);
|
|
5029
5131
|
pin(doc.documentElement, root);
|
|
5030
|
-
if (leave || pinned) {
|
|
5132
|
+
if (leave || pinned || each) {
|
|
5031
5133
|
const live = doc.documentElement.getElementsByTagName("*");
|
|
5032
5134
|
const copied = root.getElementsByTagName("*");
|
|
5033
5135
|
for (let index = 0;index < live.length; index++) {
|
|
@@ -5036,17 +5138,27 @@ ${own.join(`
|
|
|
5036
5138
|
if (!node || !copy)
|
|
5037
5139
|
continue;
|
|
5038
5140
|
if (leave?.(node))
|
|
5039
|
-
copy
|
|
5141
|
+
markOwn(copy);
|
|
5040
5142
|
pin(node, copy);
|
|
5143
|
+
each?.(node, copy);
|
|
5041
5144
|
}
|
|
5042
5145
|
}
|
|
5043
5146
|
blankPictures(doc.documentElement, root);
|
|
5044
|
-
|
|
5147
|
+
const lifted = view ? viewportOverflow(doc, view) : null;
|
|
5148
|
+
const liftedCopy = lifted === doc.documentElement ? root : lifted ? root.querySelector("body") : null;
|
|
5149
|
+
const liftedStyle = lifted && view ? view.getComputedStyle(lifted) : null;
|
|
5150
|
+
if (liftedCopy && liftedStyle && (cuts(liftedStyle.overflowX) || cuts(liftedStyle.overflowY))) {
|
|
5151
|
+
const own = liftedCopy === root && liftedStyle.display === "block" ? ";display:flow-root !important" : "";
|
|
5152
|
+
liftedCopy.setAttribute("style", `${liftedCopy.getAttribute("style") ?? ""};overflow:visible !important${own}`);
|
|
5153
|
+
}
|
|
5154
|
+
for (const node of root.querySelectorAll(`script, link, style, noscript, ${ownSelector()}`))
|
|
5045
5155
|
node.remove();
|
|
5156
|
+
const quiet = inert.createElement("style");
|
|
5157
|
+
quiet.textContent = NO_CONTROLS;
|
|
5046
5158
|
const style = inert.createElement("style");
|
|
5047
5159
|
style.textContent = frozen.rules.join(`
|
|
5048
5160
|
`);
|
|
5049
|
-
(root.querySelector("head") ?? root).append(style);
|
|
5161
|
+
(root.querySelector("head") ?? root).append(style, quiet);
|
|
5050
5162
|
return root;
|
|
5051
5163
|
}
|
|
5052
5164
|
var LONE_HALF = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
@@ -5089,7 +5201,7 @@ async function paintPage(frame2, glass, size, color, copy) {
|
|
|
5089
5201
|
const at = { x: (box2.left - screen.left) * css, y: (box2.top - screen.top) * css };
|
|
5090
5202
|
let over2 = null;
|
|
5091
5203
|
for (const node of doc.querySelectorAll(MEDIA)) {
|
|
5092
|
-
const media = node.closest(
|
|
5204
|
+
const media = node.closest(ownSelector()) ? null : mediaOf(node);
|
|
5093
5205
|
const rect = node.getBoundingClientRect();
|
|
5094
5206
|
if (!media || rect.bottom <= 0 || rect.top >= height || rect.width <= 0)
|
|
5095
5207
|
continue;
|
|
@@ -5136,6 +5248,592 @@ async function paintPage(frame2, glass, size, color, copy) {
|
|
|
5136
5248
|
return canvas;
|
|
5137
5249
|
}
|
|
5138
5250
|
|
|
5251
|
+
// src/engine/bandmedia.ts
|
|
5252
|
+
var REACH = 1;
|
|
5253
|
+
var MOST2 = 20000;
|
|
5254
|
+
var LARGEST = 4000000;
|
|
5255
|
+
var SHARPEST = 3;
|
|
5256
|
+
var KEEP_LENGTH = 48000000;
|
|
5257
|
+
var REFUSALS = 2;
|
|
5258
|
+
var MOST_REFUSED = 5000;
|
|
5259
|
+
function bandSpan(scrollY, innerHeight, band) {
|
|
5260
|
+
const top = scrollY + innerHeight;
|
|
5261
|
+
const reach = innerHeight * REACH;
|
|
5262
|
+
return { top: Math.max(0, top - reach), bottom: top + band + reach };
|
|
5263
|
+
}
|
|
5264
|
+
function inSpan(span, scrollY, innerHeight, band) {
|
|
5265
|
+
const top = scrollY + innerHeight;
|
|
5266
|
+
return top >= span.top && top + band <= span.bottom;
|
|
5267
|
+
}
|
|
5268
|
+
function meets(rect, scrollY, span) {
|
|
5269
|
+
return rect.width > 0 && rect.height > 0 && rect.bottom + scrollY > span.top && rect.top + scrollY < span.bottom;
|
|
5270
|
+
}
|
|
5271
|
+
function readSize(media, wide, tall, ratio) {
|
|
5272
|
+
const shows = ratio * Math.max(wide / media.width, tall / media.height);
|
|
5273
|
+
const scale = Math.min(1, shows, Math.sqrt(LARGEST / (media.width * media.height)));
|
|
5274
|
+
return { width: Math.max(1, Math.round(media.width * scale)), height: Math.max(1, Math.round(media.height * scale)) };
|
|
5275
|
+
}
|
|
5276
|
+
function sizedPicture(data, width, height, rendering = "") {
|
|
5277
|
+
const crisp = rendering === "pixelated" || rendering === "crisp-edges" ? ` style="image-rendering:${rendering}"` : "";
|
|
5278
|
+
return svgUrl(`<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" preserveAspectRatio="none">` + `<image href="${data}" width="${width}" height="${height}" preserveAspectRatio="none"${crisp}/></svg>`);
|
|
5279
|
+
}
|
|
5280
|
+
function readPixels(source, size) {
|
|
5281
|
+
const canvas = document.createElement("canvas");
|
|
5282
|
+
canvas.width = size.width;
|
|
5283
|
+
canvas.height = size.height;
|
|
5284
|
+
try {
|
|
5285
|
+
const pen = canvas.getContext("2d");
|
|
5286
|
+
if (!pen)
|
|
5287
|
+
return null;
|
|
5288
|
+
pen.drawImage(source, 0, 0, size.width, size.height);
|
|
5289
|
+
return canvas.toDataURL("image/webp", 0.9);
|
|
5290
|
+
} catch {
|
|
5291
|
+
return null;
|
|
5292
|
+
} finally {
|
|
5293
|
+
canvas.width = 0;
|
|
5294
|
+
canvas.height = 0;
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
var kept3 = new Map;
|
|
5298
|
+
var keptLength = 0;
|
|
5299
|
+
function keptPixels(key, read) {
|
|
5300
|
+
if (kept3.has(key)) {
|
|
5301
|
+
const data2 = kept3.get(key) ?? null;
|
|
5302
|
+
kept3.delete(key);
|
|
5303
|
+
kept3.set(key, data2);
|
|
5304
|
+
return data2;
|
|
5305
|
+
}
|
|
5306
|
+
const data = read();
|
|
5307
|
+
kept3.set(key, data);
|
|
5308
|
+
keptLength += key.length + (data?.length ?? 0);
|
|
5309
|
+
for (const [old, value] of kept3) {
|
|
5310
|
+
if (keptLength <= KEEP_LENGTH || old === key)
|
|
5311
|
+
break;
|
|
5312
|
+
kept3.delete(old);
|
|
5313
|
+
keptLength -= old.length + (value?.length ?? 0);
|
|
5314
|
+
}
|
|
5315
|
+
return data;
|
|
5316
|
+
}
|
|
5317
|
+
var probes = new Map;
|
|
5318
|
+
function forgetPixels() {
|
|
5319
|
+
kept3.clear();
|
|
5320
|
+
keptLength = 0;
|
|
5321
|
+
probes.clear();
|
|
5322
|
+
asking.clear();
|
|
5323
|
+
}
|
|
5324
|
+
var refused = new Set;
|
|
5325
|
+
var refusedOrigins = new Map;
|
|
5326
|
+
var allowed = new Set;
|
|
5327
|
+
var asking = new Map;
|
|
5328
|
+
function originOf(address) {
|
|
5329
|
+
try {
|
|
5330
|
+
return new URL(address).origin;
|
|
5331
|
+
} catch {
|
|
5332
|
+
return null;
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
function sameOrigin(address, base, origin) {
|
|
5336
|
+
try {
|
|
5337
|
+
return new URL(address, base).origin === origin;
|
|
5338
|
+
} catch {
|
|
5339
|
+
return false;
|
|
5340
|
+
}
|
|
5341
|
+
}
|
|
5342
|
+
function refuse(address, origin, found) {
|
|
5343
|
+
if (refused.has(address))
|
|
5344
|
+
return;
|
|
5345
|
+
refused.add(address);
|
|
5346
|
+
if (refused.size > MOST_REFUSED) {
|
|
5347
|
+
const [oldest] = refused;
|
|
5348
|
+
if (oldest !== undefined)
|
|
5349
|
+
refused.delete(oldest);
|
|
5350
|
+
}
|
|
5351
|
+
if (origin !== null && found && !allowed.has(origin))
|
|
5352
|
+
refusedOrigins.set(origin, (refusedOrigins.get(origin) ?? 0) + 1);
|
|
5353
|
+
}
|
|
5354
|
+
function probeOf(doc, address, cors, loaded, used) {
|
|
5355
|
+
const known = used.get(address) ?? probes.get(address);
|
|
5356
|
+
if (known && known.ownerDocument === doc) {
|
|
5357
|
+
used.set(address, known);
|
|
5358
|
+
return known;
|
|
5359
|
+
}
|
|
5360
|
+
const origin = cors ? originOf(address) : null;
|
|
5361
|
+
const shut = () => refused.has(address) || origin !== null && !allowed.has(origin) && (refusedOrigins.get(origin) ?? 0) >= REFUSALS;
|
|
5362
|
+
if (shut())
|
|
5363
|
+
return null;
|
|
5364
|
+
const ask = (withCors2) => {
|
|
5365
|
+
const image = doc.createElement("img");
|
|
5366
|
+
if (withCors2)
|
|
5367
|
+
image.crossOrigin = "anonymous";
|
|
5368
|
+
image.src = address;
|
|
5369
|
+
return image;
|
|
5370
|
+
};
|
|
5371
|
+
if (origin === null || allowed.has(origin)) {
|
|
5372
|
+
const probe = ask(cors);
|
|
5373
|
+
if (!probe.complete) {
|
|
5374
|
+
probe.addEventListener("load", loaded, { once: true });
|
|
5375
|
+
probe.addEventListener("error", () => refuse(address, origin, false), { once: true });
|
|
5376
|
+
}
|
|
5377
|
+
used.set(address, probe);
|
|
5378
|
+
return probe;
|
|
5379
|
+
}
|
|
5380
|
+
const first = asking.get(origin);
|
|
5381
|
+
if (first && first.ownerDocument === doc && !first.complete)
|
|
5382
|
+
return null;
|
|
5383
|
+
const withCors = () => {
|
|
5384
|
+
const probe = ask(true);
|
|
5385
|
+
if (probe.complete) {
|
|
5386
|
+
if (probe.naturalWidth > 0)
|
|
5387
|
+
allowed.add(origin);
|
|
5388
|
+
else
|
|
5389
|
+
refuse(address, origin, true);
|
|
5390
|
+
return probe;
|
|
5391
|
+
}
|
|
5392
|
+
asking.set(origin, probe);
|
|
5393
|
+
const settle2 = (came) => {
|
|
5394
|
+
if (came)
|
|
5395
|
+
allowed.add(origin);
|
|
5396
|
+
else
|
|
5397
|
+
refuse(address, origin, true);
|
|
5398
|
+
if (asking.get(origin) === probe) {
|
|
5399
|
+
asking.delete(origin);
|
|
5400
|
+
loaded();
|
|
5401
|
+
}
|
|
5402
|
+
};
|
|
5403
|
+
probe.addEventListener("load", () => settle2(true), { once: true });
|
|
5404
|
+
probe.addEventListener("error", () => settle2(false), { once: true });
|
|
5405
|
+
return probe;
|
|
5406
|
+
};
|
|
5407
|
+
const plain = ask(false);
|
|
5408
|
+
if (plain.complete) {
|
|
5409
|
+
if (plain.naturalWidth === 0) {
|
|
5410
|
+
refuse(address, origin, false);
|
|
5411
|
+
return null;
|
|
5412
|
+
}
|
|
5413
|
+
const probe = withCors();
|
|
5414
|
+
used.set(address, probe);
|
|
5415
|
+
return probe;
|
|
5416
|
+
}
|
|
5417
|
+
asking.set(origin, plain);
|
|
5418
|
+
plain.addEventListener("load", () => {
|
|
5419
|
+
if (asking.get(origin) !== plain)
|
|
5420
|
+
return;
|
|
5421
|
+
asking.delete(origin);
|
|
5422
|
+
if (shut()) {
|
|
5423
|
+
loaded();
|
|
5424
|
+
return;
|
|
5425
|
+
}
|
|
5426
|
+
const probe = withCors();
|
|
5427
|
+
probes.set(address, probe);
|
|
5428
|
+
if (probe.complete)
|
|
5429
|
+
loaded();
|
|
5430
|
+
}, { once: true });
|
|
5431
|
+
plain.addEventListener("error", () => {
|
|
5432
|
+
refuse(address, origin, false);
|
|
5433
|
+
if (asking.get(origin) === plain) {
|
|
5434
|
+
asking.delete(origin);
|
|
5435
|
+
loaded();
|
|
5436
|
+
}
|
|
5437
|
+
}, { once: true });
|
|
5438
|
+
return null;
|
|
5439
|
+
}
|
|
5440
|
+
function plainOf(doc, address, loaded, used) {
|
|
5441
|
+
const key = `plain|${address}`;
|
|
5442
|
+
const known = used.get(key) ?? probes.get(key);
|
|
5443
|
+
if (known && known.ownerDocument === doc) {
|
|
5444
|
+
used.set(key, known);
|
|
5445
|
+
return known;
|
|
5446
|
+
}
|
|
5447
|
+
if (refused.has(key))
|
|
5448
|
+
return null;
|
|
5449
|
+
const image = doc.createElement("img");
|
|
5450
|
+
image.src = address;
|
|
5451
|
+
if (!image.complete) {
|
|
5452
|
+
image.addEventListener("load", loaded, { once: true });
|
|
5453
|
+
image.addEventListener("error", () => refuse(key, null, false), { once: true });
|
|
5454
|
+
}
|
|
5455
|
+
used.set(key, image);
|
|
5456
|
+
return image;
|
|
5457
|
+
}
|
|
5458
|
+
function showsPoster(video) {
|
|
5459
|
+
if (!video.poster)
|
|
5460
|
+
return false;
|
|
5461
|
+
return video.readyState < 2 || video.paused && video.played.length === 0 && video.currentTime === 0;
|
|
5462
|
+
}
|
|
5463
|
+
function layersOf(value) {
|
|
5464
|
+
const parts = [];
|
|
5465
|
+
let depth = 0;
|
|
5466
|
+
let part = "";
|
|
5467
|
+
for (const char of value) {
|
|
5468
|
+
if (char === "(")
|
|
5469
|
+
depth++;
|
|
5470
|
+
if (char === ")")
|
|
5471
|
+
depth--;
|
|
5472
|
+
if (char === "," && depth === 0) {
|
|
5473
|
+
parts.push(part.trim());
|
|
5474
|
+
part = "";
|
|
5475
|
+
} else
|
|
5476
|
+
part += char;
|
|
5477
|
+
}
|
|
5478
|
+
parts.push(part.trim());
|
|
5479
|
+
return parts;
|
|
5480
|
+
}
|
|
5481
|
+
function urlOf(layer) {
|
|
5482
|
+
const found = /^url\(\s*(["']?)(.*)\1\s*\)$/s.exec(layer);
|
|
5483
|
+
return found?.[2] ?? null;
|
|
5484
|
+
}
|
|
5485
|
+
function sizeOf(fit, media, wide, tall) {
|
|
5486
|
+
if (fit === "cover" || fit === "contain")
|
|
5487
|
+
return fit;
|
|
5488
|
+
if (fit === "none")
|
|
5489
|
+
return "auto";
|
|
5490
|
+
if (fit === "scale-down")
|
|
5491
|
+
return media.width > wide || media.height > tall ? "contain" : "auto";
|
|
5492
|
+
return "100% 100%";
|
|
5493
|
+
}
|
|
5494
|
+
function clipOf(node, doc, view, boxOf2) {
|
|
5495
|
+
for (let at = node.parentElement;at && at !== doc.body && at !== doc.documentElement; at = at.parentElement) {
|
|
5496
|
+
const style = view.getComputedStyle(at);
|
|
5497
|
+
if (style.overflowX === "visible" && style.overflowY === "visible")
|
|
5498
|
+
continue;
|
|
5499
|
+
return { rect: boxOf2(at.getBoundingClientRect()), radius: Number.parseFloat(style.borderTopLeftRadius) || 0 };
|
|
5500
|
+
}
|
|
5501
|
+
return;
|
|
5502
|
+
}
|
|
5503
|
+
function pinned(node, view) {
|
|
5504
|
+
for (let at = node;at; at = at.parentElement) {
|
|
5505
|
+
if (view.getComputedStyle(at).position === "fixed")
|
|
5506
|
+
return true;
|
|
5507
|
+
}
|
|
5508
|
+
return false;
|
|
5509
|
+
}
|
|
5510
|
+
function visible(node) {
|
|
5511
|
+
if (typeof node.checkVisibility !== "function")
|
|
5512
|
+
return true;
|
|
5513
|
+
return node.checkVisibility({ opacityProperty: true, visibilityProperty: true, checkOpacity: true, checkVisibilityCSS: true });
|
|
5514
|
+
}
|
|
5515
|
+
function overlap(a, b) {
|
|
5516
|
+
return Math.min(a.right, b.right) - Math.max(a.left, b.left) > 0.5 && Math.min(a.bottom, b.bottom) - Math.max(a.top, b.top) > 0.5;
|
|
5517
|
+
}
|
|
5518
|
+
var STACKS_CHILDREN = new Set(["flex", "inline-flex", "grid", "inline-grid"]);
|
|
5519
|
+
var inEffect = (value, initial = "none") => (value || initial) !== initial;
|
|
5520
|
+
var names = (value, words2) => (value ?? "").split(/[\s,]+/).some((word) => words2.has(word));
|
|
5521
|
+
var CONTAINS = new Set(["paint", "layout", "strict", "content"]);
|
|
5522
|
+
var CHANGES = new Set(["transform", "opacity", "filter", "scale", "rotate", "translate", "isolation", "mix-blend-mode", "perspective", "clip-path", "mask", "contain", "backdrop-filter", "mask-image", "-webkit-mask-image", "position", "view-transition-name", "offset-path"]);
|
|
5523
|
+
function boxOf2(node, view) {
|
|
5524
|
+
for (let at = node.parentElement;at; at = at.parentElement) {
|
|
5525
|
+
const style = view.getComputedStyle(at);
|
|
5526
|
+
if (style.display !== "contents")
|
|
5527
|
+
return style;
|
|
5528
|
+
}
|
|
5529
|
+
return null;
|
|
5530
|
+
}
|
|
5531
|
+
function contextOf(style) {
|
|
5532
|
+
return style.position === "fixed" || style.position === "sticky" || inEffect(style.transform) || inEffect(style.scale) || inEffect(style.rotate) || inEffect(style.translate) || inEffect(style.filter) || inEffect(style.backdropFilter) || inEffect(style.perspective) || inEffect(style.clipPath) || inEffect(style.maskImage) || inEffect(style.webkitMaskImage) || inEffect(style.mixBlendMode, "normal") || Number.parseFloat(style.opacity) < 1 || style.isolation === "isolate" || names(style.contain, CONTAINS) || inEffect(style.viewTransitionName) || style.contentVisibility === "auto" || inEffect(style.offsetPath) || names(style.willChange, CHANGES);
|
|
5533
|
+
}
|
|
5534
|
+
function rankOf(node, top, view) {
|
|
5535
|
+
let rank = 0;
|
|
5536
|
+
for (let at = node;at && at !== top; at = at.parentElement) {
|
|
5537
|
+
const style = view.getComputedStyle(at);
|
|
5538
|
+
if (style.display === "contents")
|
|
5539
|
+
continue;
|
|
5540
|
+
const positioned = style.position !== "static";
|
|
5541
|
+
const holder = boxOf2(at, view)?.display;
|
|
5542
|
+
const z = positioned || holder && STACKS_CHILDREN.has(holder) ? Number.parseInt(style.zIndex, 10) : Number.NaN;
|
|
5543
|
+
if (Number.isFinite(z) || contextOf(style))
|
|
5544
|
+
rank = !Number.isFinite(z) || z === 0 ? 1 : z < 0 ? z : 1 + z;
|
|
5545
|
+
else if (positioned && rank === 0)
|
|
5546
|
+
rank = 1;
|
|
5547
|
+
}
|
|
5548
|
+
return rank;
|
|
5549
|
+
}
|
|
5550
|
+
function paintsOver(node, media, after, view) {
|
|
5551
|
+
let top = node.parentElement;
|
|
5552
|
+
while (top && !top.contains(media))
|
|
5553
|
+
top = top.parentElement;
|
|
5554
|
+
if (!top)
|
|
5555
|
+
return false;
|
|
5556
|
+
const rank = rankOf(node, top, view) - rankOf(media, top, view);
|
|
5557
|
+
return rank > 0 || rank === 0 && after;
|
|
5558
|
+
}
|
|
5559
|
+
function covered(doc, view, own, pending2) {
|
|
5560
|
+
const over2 = new Set;
|
|
5561
|
+
const above = new Set;
|
|
5562
|
+
const nodes = new Set(pending2.map((one) => one.node));
|
|
5563
|
+
const met = new Set;
|
|
5564
|
+
const all = doc.documentElement.getElementsByTagName("*");
|
|
5565
|
+
for (let index = 0;index < all.length && index < MOST2; index++) {
|
|
5566
|
+
const node = all[index];
|
|
5567
|
+
if (!node)
|
|
5568
|
+
continue;
|
|
5569
|
+
if (nodes.has(node))
|
|
5570
|
+
met.add(node);
|
|
5571
|
+
const rect = node.getBoundingClientRect();
|
|
5572
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
5573
|
+
continue;
|
|
5574
|
+
for (const one of pending2) {
|
|
5575
|
+
if (node === one.node || node.contains(one.node) || !overlap(rect, one.rect))
|
|
5576
|
+
continue;
|
|
5577
|
+
if (!visible(node) || node.closest(own) || pinned(node, view) || !paintsOver(node, one.node, met.has(one.node), view))
|
|
5578
|
+
continue;
|
|
5579
|
+
over2.add(one.node);
|
|
5580
|
+
above.add(node);
|
|
5581
|
+
}
|
|
5582
|
+
}
|
|
5583
|
+
return { over: over2, above };
|
|
5584
|
+
}
|
|
5585
|
+
function bandMedia(doc, view, span, loaded, scrollY = view.scrollY) {
|
|
5586
|
+
const fills = new Map;
|
|
5587
|
+
const pending2 = [];
|
|
5588
|
+
const used = new Map;
|
|
5589
|
+
const ratio = Math.min(SHARPEST, Math.max(1, view.devicePixelRatio || 1));
|
|
5590
|
+
const { scrollX } = view;
|
|
5591
|
+
const own = ownSelector();
|
|
5592
|
+
const origin = view.location.origin;
|
|
5593
|
+
const boxOf3 = (rect) => ({ left: rect.left + scrollX, top: rect.top + scrollY, width: rect.width, height: rect.height });
|
|
5594
|
+
const add = (node, put) => {
|
|
5595
|
+
const before = fills.get(node);
|
|
5596
|
+
fills.set(node, before ? (copy) => (before(copy), put(copy)) : put);
|
|
5597
|
+
};
|
|
5598
|
+
const restyle = (copy, css) => copy.setAttribute("style", `${copy.getAttribute("style") ?? ""};${css}`);
|
|
5599
|
+
const fill = (node, rect, style, media, data) => {
|
|
5600
|
+
const px = (value) => Number.parseFloat(value) || 0;
|
|
5601
|
+
const wide = rect.width - px(style.borderLeftWidth) - px(style.paddingLeft) - px(style.borderRightWidth) - px(style.paddingRight);
|
|
5602
|
+
const tall = rect.height - px(style.borderTopWidth) - px(style.paddingTop) - px(style.borderBottomWidth) - px(style.paddingBottom);
|
|
5603
|
+
const picture = sizedPicture(data, media.width, media.height, style.imageRendering);
|
|
5604
|
+
const size = "videoWidth" in node ? node.videoWidth > 0 ? { width: node.videoWidth, height: node.videoHeight } : media : null;
|
|
5605
|
+
add(node, (copy) => {
|
|
5606
|
+
if (size && !copy.hasAttribute("width") && !copy.hasAttribute("height")) {
|
|
5607
|
+
copy.setAttribute("width", String(size.width));
|
|
5608
|
+
copy.setAttribute("height", String(size.height));
|
|
5609
|
+
}
|
|
5610
|
+
restyle(copy, `background-image:url("${picture}") !important;background-size:${sizeOf(style.objectFit, media, wide, tall)} !important;` + `background-position:${style.objectPosition} !important;background-repeat:no-repeat !important;background-origin:content-box !important`);
|
|
5611
|
+
});
|
|
5612
|
+
};
|
|
5613
|
+
for (const node of doc.querySelectorAll(MEDIA)) {
|
|
5614
|
+
const rect = node.getBoundingClientRect();
|
|
5615
|
+
if (!meets(rect, scrollY, span) || node.closest(own))
|
|
5616
|
+
continue;
|
|
5617
|
+
if ("videoWidth" in node && showsPoster(node)) {
|
|
5618
|
+
if (pinned(node, view))
|
|
5619
|
+
continue;
|
|
5620
|
+
const address = node.poster;
|
|
5621
|
+
const style2 = view.getComputedStyle(node);
|
|
5622
|
+
const cors = !sameOrigin(address, doc.baseURI, origin);
|
|
5623
|
+
const probe = probeOf(doc, address, cors, loaded, used);
|
|
5624
|
+
const media2 = probe && mediaOf(probe);
|
|
5625
|
+
if (probe && media2) {
|
|
5626
|
+
const size2 = readSize(media2, rect.width, rect.height, ratio);
|
|
5627
|
+
const data2 = keptPixels(`${address}|${cors ? "cors|" : ""}${size2.width}x${size2.height}`, () => readPixels(probe, size2));
|
|
5628
|
+
if (data2 !== null) {
|
|
5629
|
+
fill(node, rect, style2, media2, data2);
|
|
5630
|
+
continue;
|
|
5631
|
+
}
|
|
5632
|
+
}
|
|
5633
|
+
const plain = visible(node) ? plainOf(doc, address, loaded, used) : null;
|
|
5634
|
+
const shown2 = plain && mediaOf(plain);
|
|
5635
|
+
if (shown2)
|
|
5636
|
+
pending2.push({ node, rect, draw: () => ({ media: shown2, rect: boxOf3(rect), style: style2, clip: clipOf(node, doc, view, boxOf3) }) });
|
|
5637
|
+
continue;
|
|
5638
|
+
}
|
|
5639
|
+
const media = mediaOf(node);
|
|
5640
|
+
if (!media || pinned(node, view))
|
|
5641
|
+
continue;
|
|
5642
|
+
const style = view.getComputedStyle(node);
|
|
5643
|
+
if ("naturalWidth" in node) {
|
|
5644
|
+
const address = node.currentSrc || node.src;
|
|
5645
|
+
if (address.startsWith("data:")) {
|
|
5646
|
+
add(node, (copy) => copy.setAttribute("src", address));
|
|
5647
|
+
continue;
|
|
5648
|
+
}
|
|
5649
|
+
const dense = node.srcset || node.parentElement?.localName === "picture" ? ratio : 1;
|
|
5650
|
+
const size2 = readSize({ width: media.width * dense, height: media.height * dense }, rect.width, rect.height, ratio);
|
|
5651
|
+
const sized = `${size2.width}x${size2.height}`;
|
|
5652
|
+
let data2 = keptPixels(`${address}|${sized}`, () => readPixels(node, size2));
|
|
5653
|
+
if (data2 === null) {
|
|
5654
|
+
const probe = probeOf(doc, address, true, loaded, used);
|
|
5655
|
+
if (probe && mediaOf(probe))
|
|
5656
|
+
data2 = keptPixels(`${address}|cors|${sized}`, () => readPixels(probe, size2));
|
|
5657
|
+
}
|
|
5658
|
+
if (data2 !== null) {
|
|
5659
|
+
const read = data2;
|
|
5660
|
+
add(node, (copy) => copy.setAttribute("src", sizedPicture(read, media.width, media.height, style.imageRendering)));
|
|
5661
|
+
continue;
|
|
5662
|
+
}
|
|
5663
|
+
if (!visible(node))
|
|
5664
|
+
continue;
|
|
5665
|
+
pending2.push({
|
|
5666
|
+
node,
|
|
5667
|
+
rect,
|
|
5668
|
+
draw: () => {
|
|
5669
|
+
const whole = document.createElement("canvas");
|
|
5670
|
+
whole.width = size2.width;
|
|
5671
|
+
whole.height = size2.height;
|
|
5672
|
+
try {
|
|
5673
|
+
whole.getContext("2d")?.drawImage(node, 0, 0, size2.width, size2.height);
|
|
5674
|
+
} catch {
|
|
5675
|
+
whole.width = 0;
|
|
5676
|
+
whole.height = 0;
|
|
5677
|
+
return null;
|
|
5678
|
+
}
|
|
5679
|
+
const drawn = { source: whole, width: media.width, height: media.height, scale: size2.width / media.width };
|
|
5680
|
+
return { media: drawn, rect: boxOf3(rect), style, made: whole, clip: clipOf(node, doc, view, boxOf3) };
|
|
5681
|
+
}
|
|
5682
|
+
});
|
|
5683
|
+
continue;
|
|
5684
|
+
}
|
|
5685
|
+
if ("videoWidth" in node && !node.paused) {
|
|
5686
|
+
if (visible(node))
|
|
5687
|
+
pending2.push({ node, rect, draw: () => ({ media, rect: boxOf3(rect), style, clip: clipOf(node, doc, view, boxOf3), live: node }) });
|
|
5688
|
+
continue;
|
|
5689
|
+
}
|
|
5690
|
+
const size = readSize(media, rect.width, rect.height, ratio);
|
|
5691
|
+
const data = readPixels(node, size);
|
|
5692
|
+
if (data === null) {
|
|
5693
|
+
if (visible(node))
|
|
5694
|
+
pending2.push({ node, rect, draw: () => ({ media, rect: boxOf3(rect), style, clip: clipOf(node, doc, view, boxOf3) }) });
|
|
5695
|
+
continue;
|
|
5696
|
+
}
|
|
5697
|
+
fill(node, rect, style, media, data);
|
|
5698
|
+
}
|
|
5699
|
+
const all = doc.documentElement.getElementsByTagName("*");
|
|
5700
|
+
for (let index = 0;index < all.length && index < MOST2; index++) {
|
|
5701
|
+
const node = all[index];
|
|
5702
|
+
if (!node)
|
|
5703
|
+
continue;
|
|
5704
|
+
const rect = node.getBoundingClientRect();
|
|
5705
|
+
if (!meets(rect, scrollY, span))
|
|
5706
|
+
continue;
|
|
5707
|
+
const style = view.getComputedStyle(node);
|
|
5708
|
+
const value = style.backgroundImage;
|
|
5709
|
+
if (!value?.includes("url(") || node.closest(own) || pinned(node, view))
|
|
5710
|
+
continue;
|
|
5711
|
+
let read = false;
|
|
5712
|
+
const shown2 = layersOf(value).map((layer) => {
|
|
5713
|
+
const address = urlOf(layer);
|
|
5714
|
+
if (address === null || address.startsWith("data:"))
|
|
5715
|
+
return layer;
|
|
5716
|
+
const cors = !sameOrigin(address, doc.baseURI, origin);
|
|
5717
|
+
const probe = probeOf(doc, address, cors, loaded, used);
|
|
5718
|
+
const media = probe && mediaOf(probe);
|
|
5719
|
+
if (!media)
|
|
5720
|
+
return layer;
|
|
5721
|
+
const size = readSize(media, rect.width, rect.height, ratio);
|
|
5722
|
+
const data = keptPixels(`${address}|${cors ? "cors|" : ""}${size.width}x${size.height}`, () => readPixels(probe, size));
|
|
5723
|
+
if (data === null)
|
|
5724
|
+
return layer;
|
|
5725
|
+
read = true;
|
|
5726
|
+
return `url("${sizedPicture(data, media.width, media.height, style.imageRendering)}")`;
|
|
5727
|
+
});
|
|
5728
|
+
if (read) {
|
|
5729
|
+
const css = `background-image:${shown2.join(", ")} !important`;
|
|
5730
|
+
add(node, (copy) => restyle(copy, css));
|
|
5731
|
+
}
|
|
5732
|
+
}
|
|
5733
|
+
probes = used;
|
|
5734
|
+
const { over: over2, above } = pending2.length > 0 ? covered(doc, view, own, pending2) : { over: new Set, above: new Set };
|
|
5735
|
+
const unread = [];
|
|
5736
|
+
for (const one of pending2) {
|
|
5737
|
+
const drawn = one.draw();
|
|
5738
|
+
if (drawn)
|
|
5739
|
+
unread.push(over2.has(one.node) ? { ...drawn, covered: true } : drawn);
|
|
5740
|
+
}
|
|
5741
|
+
return { fills, unread, above };
|
|
5742
|
+
}
|
|
5743
|
+
function clipTo(pen, one) {
|
|
5744
|
+
const { rect, clip } = one;
|
|
5745
|
+
if (clip) {
|
|
5746
|
+
pen.beginPath();
|
|
5747
|
+
pen.roundRect(clip.rect.left, clip.rect.top, clip.rect.width, clip.rect.height, clip.radius);
|
|
5748
|
+
pen.clip();
|
|
5749
|
+
}
|
|
5750
|
+
pen.beginPath();
|
|
5751
|
+
pen.rect(rect.left, rect.top, rect.width, rect.height);
|
|
5752
|
+
pen.clip();
|
|
5753
|
+
}
|
|
5754
|
+
function drawOne(pen, one) {
|
|
5755
|
+
pen.save();
|
|
5756
|
+
try {
|
|
5757
|
+
if (one.clip) {
|
|
5758
|
+
pen.beginPath();
|
|
5759
|
+
pen.roundRect(one.clip.rect.left, one.clip.rect.top, one.clip.rect.width, one.clip.rect.height, one.clip.radius);
|
|
5760
|
+
pen.clip();
|
|
5761
|
+
}
|
|
5762
|
+
drawMedia(pen, one.media, one.rect, one.style);
|
|
5763
|
+
} catch {}
|
|
5764
|
+
pen.restore();
|
|
5765
|
+
}
|
|
5766
|
+
function overlayOf(unread, span, width, ratio, above = null) {
|
|
5767
|
+
if (unread.length === 0)
|
|
5768
|
+
return null;
|
|
5769
|
+
const canvas = document.createElement("canvas");
|
|
5770
|
+
canvas.width = Math.max(1, Math.round(width * ratio));
|
|
5771
|
+
canvas.height = Math.max(1, Math.round((span.bottom - span.top) * ratio));
|
|
5772
|
+
const pen = canvas.getContext("2d");
|
|
5773
|
+
if (!pen)
|
|
5774
|
+
return null;
|
|
5775
|
+
pen.setTransform(ratio, 0, 0, ratio, 0, -span.top * ratio);
|
|
5776
|
+
for (const one of unread) {
|
|
5777
|
+
drawOne(pen, one);
|
|
5778
|
+
if (one.made) {
|
|
5779
|
+
one.made.width = 0;
|
|
5780
|
+
one.made.height = 0;
|
|
5781
|
+
}
|
|
5782
|
+
}
|
|
5783
|
+
const parts = unread.filter((one) => one.covered);
|
|
5784
|
+
return { canvas, span, width, ratio, live: unread.filter((one) => one.live), above: above && parts.length > 0 ? { src: above, parts } : null };
|
|
5785
|
+
}
|
|
5786
|
+
function raiseOf(overlay, image) {
|
|
5787
|
+
const { span, width, ratio } = overlay;
|
|
5788
|
+
const canvas = document.createElement("canvas");
|
|
5789
|
+
canvas.width = overlay.canvas.width;
|
|
5790
|
+
canvas.height = overlay.canvas.height;
|
|
5791
|
+
const pen = canvas.getContext("2d");
|
|
5792
|
+
if (!pen)
|
|
5793
|
+
return null;
|
|
5794
|
+
const tall = span.bottom - span.top;
|
|
5795
|
+
pen.setTransform(ratio, 0, 0, ratio, 0, -span.top * ratio);
|
|
5796
|
+
try {
|
|
5797
|
+
pen.drawImage(image, 0, span.top, width, tall, 0, span.top, width, tall);
|
|
5798
|
+
} catch {
|
|
5799
|
+
canvas.width = 0;
|
|
5800
|
+
canvas.height = 0;
|
|
5801
|
+
return null;
|
|
5802
|
+
}
|
|
5803
|
+
return canvas;
|
|
5804
|
+
}
|
|
5805
|
+
function drawAbove(overlay, raised, only) {
|
|
5806
|
+
const { canvas, span, width, ratio, above } = overlay;
|
|
5807
|
+
const pen = above && canvas.getContext("2d");
|
|
5808
|
+
if (!above || !pen)
|
|
5809
|
+
return;
|
|
5810
|
+
pen.setTransform(ratio, 0, 0, ratio, 0, -span.top * ratio);
|
|
5811
|
+
for (const part of above.parts) {
|
|
5812
|
+
if (only && part !== only)
|
|
5813
|
+
continue;
|
|
5814
|
+
pen.save();
|
|
5815
|
+
try {
|
|
5816
|
+
clipTo(pen, part);
|
|
5817
|
+
pen.drawImage(raised, 0, span.top, width, span.bottom - span.top);
|
|
5818
|
+
} catch {}
|
|
5819
|
+
pen.restore();
|
|
5820
|
+
}
|
|
5821
|
+
}
|
|
5822
|
+
function redrawLive(overlay, one, raised) {
|
|
5823
|
+
const { canvas, span, ratio } = overlay;
|
|
5824
|
+
const pen = canvas.getContext("2d");
|
|
5825
|
+
if (!pen)
|
|
5826
|
+
return;
|
|
5827
|
+
pen.setTransform(ratio, 0, 0, ratio, 0, -span.top * ratio);
|
|
5828
|
+
pen.save();
|
|
5829
|
+
clipTo(pen, one);
|
|
5830
|
+
pen.clearRect(one.rect.left, one.rect.top, one.rect.width, one.rect.height);
|
|
5831
|
+
pen.restore();
|
|
5832
|
+
drawOne(pen, one);
|
|
5833
|
+
if (raised && one.covered)
|
|
5834
|
+
drawAbove(overlay, raised, one);
|
|
5835
|
+
}
|
|
5836
|
+
|
|
5139
5837
|
// src/engine/underbar.ts
|
|
5140
5838
|
var UNDERBAR_CSS = `
|
|
5141
5839
|
.underbar {
|
|
@@ -5145,7 +5843,8 @@ var UNDERBAR_CSS = `
|
|
|
5145
5843
|
transform-origin: 0 0;
|
|
5146
5844
|
}
|
|
5147
5845
|
.underbar[hidden] { display: none; }
|
|
5148
|
-
.underbar > img
|
|
5846
|
+
.underbar > img,
|
|
5847
|
+
.underbar > canvas {
|
|
5149
5848
|
position: absolute;
|
|
5150
5849
|
left: 0;
|
|
5151
5850
|
top: 0;
|
|
@@ -5153,6 +5852,7 @@ var UNDERBAR_CSS = `
|
|
|
5153
5852
|
will-change: transform;
|
|
5154
5853
|
}
|
|
5155
5854
|
`;
|
|
5855
|
+
var LOADS = ["load", "loadeddata", "seeked", "playing"];
|
|
5156
5856
|
var GAP = 250;
|
|
5157
5857
|
var SHARE = 10;
|
|
5158
5858
|
function bandRect(page, height) {
|
|
@@ -5174,13 +5874,54 @@ var VH = /(-?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?)[sld]?vh\b/gi;
|
|
|
5174
5874
|
function viewportUnits(css, height) {
|
|
5175
5875
|
return css.replace(VH, (_, amount) => `${Math.round(Number(amount) * height) / 100}px`);
|
|
5176
5876
|
}
|
|
5177
|
-
function
|
|
5877
|
+
function bodyScroller(doc, view) {
|
|
5878
|
+
const { body } = doc;
|
|
5879
|
+
if (!body || viewportOverflow(doc, view) !== doc.documentElement)
|
|
5880
|
+
return null;
|
|
5881
|
+
const { overflowY } = view.getComputedStyle(body);
|
|
5882
|
+
return cuts(overflowY) && overflowY !== "clip" ? body : null;
|
|
5883
|
+
}
|
|
5884
|
+
function scrollOf(doc, view) {
|
|
5885
|
+
return view.scrollY + (bodyScroller(doc, view)?.scrollTop ?? 0);
|
|
5886
|
+
}
|
|
5887
|
+
function heightOf(doc, view) {
|
|
5888
|
+
const full = doc.documentElement.scrollHeight;
|
|
5889
|
+
const body = bodyScroller(doc, view);
|
|
5890
|
+
if (!body)
|
|
5891
|
+
return full;
|
|
5892
|
+
return Math.max(full, body.getBoundingClientRect().top + view.scrollY + body.clientTop + body.scrollHeight);
|
|
5893
|
+
}
|
|
5894
|
+
function unscroll(copy, body, view) {
|
|
5895
|
+
const style = view.getComputedStyle(body);
|
|
5896
|
+
const own = style.display === "block" ? ";display:flow-root !important" : "";
|
|
5897
|
+
copy.setAttribute("style", `${copy.getAttribute("style") ?? ""};overflow-x:clip !important;overflow-y:visible !important${own}`);
|
|
5898
|
+
}
|
|
5899
|
+
function isMedia(target) {
|
|
5900
|
+
return target !== null && "currentSrc" in target;
|
|
5901
|
+
}
|
|
5902
|
+
function nearLoad(target, scrollY, span) {
|
|
5903
|
+
if (!isMedia(target))
|
|
5904
|
+
return false;
|
|
5905
|
+
return meets(target.getBoundingClientRect(), scrollY, span);
|
|
5906
|
+
}
|
|
5907
|
+
function pictureOf(frame2, band = 0, loaded = () => {}) {
|
|
5178
5908
|
const doc = frame2.contentDocument;
|
|
5179
5909
|
const view = frame2.contentWindow;
|
|
5180
5910
|
if (!doc?.documentElement || !view || view.innerWidth <= 0)
|
|
5181
5911
|
return null;
|
|
5182
5912
|
const { innerWidth: width, innerHeight: tall } = view;
|
|
5183
|
-
const
|
|
5913
|
+
const scrolled = scrollOf(doc, view);
|
|
5914
|
+
const span = bandSpan(scrolled, tall, band);
|
|
5915
|
+
const media = bandMedia(doc, view, span, loaded, scrolled);
|
|
5916
|
+
const puts = [];
|
|
5917
|
+
const above = [];
|
|
5918
|
+
const copy = copyPage(frame2, (node) => view.getComputedStyle(node).position === "fixed", (node, copied) => {
|
|
5919
|
+
const put = media.fills.get(node);
|
|
5920
|
+
if (put)
|
|
5921
|
+
puts.push(() => put(copied));
|
|
5922
|
+
if (media.above.has(node))
|
|
5923
|
+
above.push(copied);
|
|
5924
|
+
});
|
|
5184
5925
|
if (!copy)
|
|
5185
5926
|
return null;
|
|
5186
5927
|
for (const style of copy.querySelectorAll("style")) {
|
|
@@ -5189,14 +5930,35 @@ function pictureOf(frame2) {
|
|
|
5189
5930
|
for (const node of copy.querySelectorAll("[style]")) {
|
|
5190
5931
|
node.setAttribute("style", viewportUnits(node.getAttribute("style") ?? "", tall));
|
|
5191
5932
|
}
|
|
5192
|
-
const
|
|
5933
|
+
for (const put of puts)
|
|
5934
|
+
put();
|
|
5935
|
+
const scroller = bodyScroller(doc, view);
|
|
5936
|
+
const body = scroller ? copy.querySelector("body") : null;
|
|
5937
|
+
if (scroller && body)
|
|
5938
|
+
unscroll(body, scroller, view);
|
|
5939
|
+
const full = Math.max(heightOf(doc, view), tall);
|
|
5193
5940
|
const root = doc.documentElement.getBoundingClientRect().height / ownZoom(doc, view);
|
|
5194
5941
|
const sized = rootSize(doc, view);
|
|
5195
5942
|
const zoom = layoutZoom(view);
|
|
5196
5943
|
const zoomed = rootZoom(doc, view, zoom);
|
|
5197
5944
|
copy.setAttribute("style", `${copy.getAttribute("style") ?? ""};${sized};height:${root}px !important${zoomed}`);
|
|
5198
5945
|
const markup = new XMLSerializer().serializeToString(copy);
|
|
5199
|
-
|
|
5946
|
+
const shows = doc.querySelector(MEDIA) !== null || /url\(\s*(?!["']?data:|"data:)/i.test(markup);
|
|
5947
|
+
const ratio = Math.min(2, Math.max(1, window.devicePixelRatio || 1));
|
|
5948
|
+
return {
|
|
5949
|
+
src: svgUrl(drawing(markup, width, full, sized, zoom)),
|
|
5950
|
+
width,
|
|
5951
|
+
height: full,
|
|
5952
|
+
span: shows ? span : null,
|
|
5953
|
+
overlay: overlayOf(media.unread, span, width, ratio, above.length > 0 ? svgUrl(drawing(aboveOnly(copy, above), width, full, sized, zoom)) : null)
|
|
5954
|
+
};
|
|
5955
|
+
}
|
|
5956
|
+
function aboveOnly(copy, shown2) {
|
|
5957
|
+
const restyle = (node, css) => node.setAttribute("style", `${node.getAttribute("style") ?? ""};${css}`);
|
|
5958
|
+
restyle(copy, "visibility:hidden !important");
|
|
5959
|
+
for (const node of shown2)
|
|
5960
|
+
restyle(node, "visibility:visible !important");
|
|
5961
|
+
return new XMLSerializer().serializeToString(copy);
|
|
5200
5962
|
}
|
|
5201
5963
|
function createUnderbar(glass, frame2) {
|
|
5202
5964
|
const band = el("div", "underbar");
|
|
@@ -5205,6 +5967,7 @@ function createUnderbar(glass, frame2) {
|
|
|
5205
5967
|
glass.append(band);
|
|
5206
5968
|
let image = null;
|
|
5207
5969
|
let picture = null;
|
|
5970
|
+
let cover = null;
|
|
5208
5971
|
let taken = "";
|
|
5209
5972
|
let watched2 = null;
|
|
5210
5973
|
let observer = null;
|
|
@@ -5214,6 +5977,68 @@ function createUnderbar(glass, frame2) {
|
|
|
5214
5977
|
let last = 0;
|
|
5215
5978
|
let cost = 0;
|
|
5216
5979
|
let wide = 0;
|
|
5980
|
+
let high = 0;
|
|
5981
|
+
const again = () => {
|
|
5982
|
+
changed = true;
|
|
5983
|
+
soon();
|
|
5984
|
+
};
|
|
5985
|
+
const bandOf = (across) => wide > 0 ? high * across / wide : 0;
|
|
5986
|
+
const onLoad = (event) => {
|
|
5987
|
+
if (picture?.overlay?.live.some((one) => one.live === event.target))
|
|
5988
|
+
return;
|
|
5989
|
+
try {
|
|
5990
|
+
const view = frame2.contentWindow;
|
|
5991
|
+
const doc = frame2.contentDocument;
|
|
5992
|
+
if (!view || !doc || band.hidden)
|
|
5993
|
+
return;
|
|
5994
|
+
const scrolled = scrollOf(doc, view);
|
|
5995
|
+
const span = bandSpan(scrolled, view.innerHeight, bandOf(view.innerWidth));
|
|
5996
|
+
if (nearLoad(event.target, scrolled, span))
|
|
5997
|
+
again();
|
|
5998
|
+
} catch {}
|
|
5999
|
+
};
|
|
6000
|
+
const onScroll = (event) => {
|
|
6001
|
+
if (event.target === watched2?.body)
|
|
6002
|
+
move();
|
|
6003
|
+
};
|
|
6004
|
+
const spend2 = (canvas) => {
|
|
6005
|
+
if (!canvas)
|
|
6006
|
+
return;
|
|
6007
|
+
canvas.width = 0;
|
|
6008
|
+
canvas.height = 0;
|
|
6009
|
+
};
|
|
6010
|
+
let raised = null;
|
|
6011
|
+
const dropCover = () => {
|
|
6012
|
+
spend2(raised);
|
|
6013
|
+
raised = null;
|
|
6014
|
+
if (!cover)
|
|
6015
|
+
return;
|
|
6016
|
+
cover.remove();
|
|
6017
|
+
cover.width = 0;
|
|
6018
|
+
cover.height = 0;
|
|
6019
|
+
cover = null;
|
|
6020
|
+
};
|
|
6021
|
+
const follow4 = (overlay) => {
|
|
6022
|
+
for (const one of overlay.live) {
|
|
6023
|
+
const video = one.live;
|
|
6024
|
+
if (!video)
|
|
6025
|
+
continue;
|
|
6026
|
+
const ask = () => {
|
|
6027
|
+
if (typeof video.requestVideoFrameCallback === "function")
|
|
6028
|
+
video.requestVideoFrameCallback(step);
|
|
6029
|
+
else
|
|
6030
|
+
window.requestAnimationFrame(step);
|
|
6031
|
+
};
|
|
6032
|
+
const step = () => {
|
|
6033
|
+
if (cover !== overlay.canvas)
|
|
6034
|
+
return;
|
|
6035
|
+
if (!band.hidden)
|
|
6036
|
+
redrawLive(overlay, one, raised);
|
|
6037
|
+
ask();
|
|
6038
|
+
};
|
|
6039
|
+
ask();
|
|
6040
|
+
}
|
|
6041
|
+
};
|
|
5217
6042
|
const keyOf = () => {
|
|
5218
6043
|
try {
|
|
5219
6044
|
const doc = frame2.contentDocument;
|
|
@@ -5222,20 +6047,24 @@ function createUnderbar(glass, frame2) {
|
|
|
5222
6047
|
return null;
|
|
5223
6048
|
if (doc !== watched2) {
|
|
5224
6049
|
observer?.disconnect();
|
|
5225
|
-
const
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
6050
|
+
for (const type of LOADS)
|
|
6051
|
+
watched2?.removeEventListener(type, onLoad, true);
|
|
6052
|
+
watched2?.removeEventListener("scroll", onScroll, true);
|
|
6053
|
+
const next = new MutationObserver(again);
|
|
5229
6054
|
next.observe(doc, { subtree: true, childList: true, attributes: true, characterData: true });
|
|
6055
|
+
for (const type of LOADS)
|
|
6056
|
+
doc.addEventListener(type, onLoad, true);
|
|
6057
|
+
doc.addEventListener("scroll", onScroll, true);
|
|
5230
6058
|
observer = next;
|
|
5231
6059
|
watched2 = doc;
|
|
5232
6060
|
changed = true;
|
|
5233
6061
|
image?.remove();
|
|
5234
6062
|
image = null;
|
|
5235
6063
|
picture = null;
|
|
6064
|
+
dropCover();
|
|
5236
6065
|
taken = "";
|
|
5237
6066
|
}
|
|
5238
|
-
return `${view.innerWidth}|${view.innerHeight}|${doc
|
|
6067
|
+
return `${view.innerWidth}|${view.innerHeight}|${heightOf(doc, view)}`;
|
|
5239
6068
|
} catch {
|
|
5240
6069
|
return null;
|
|
5241
6070
|
}
|
|
@@ -5245,10 +6074,17 @@ function createUnderbar(glass, frame2) {
|
|
|
5245
6074
|
return;
|
|
5246
6075
|
try {
|
|
5247
6076
|
const view = frame2.contentWindow;
|
|
5248
|
-
|
|
6077
|
+
const doc = frame2.contentDocument;
|
|
6078
|
+
if (!view || !doc)
|
|
5249
6079
|
return;
|
|
5250
|
-
const
|
|
6080
|
+
const scale = wide / picture.width;
|
|
6081
|
+
const scrolled = scrollOf(doc, view);
|
|
6082
|
+
const shift = bandShift(scrolled, view.innerHeight, scale);
|
|
5251
6083
|
image.style.transform = `translate3d(0, ${shift}px, 0)`;
|
|
6084
|
+
if (cover && picture.overlay)
|
|
6085
|
+
cover.style.transform = `translate3d(0, ${shift + picture.overlay.span.top * scale}px, 0)`;
|
|
6086
|
+
if (picture.span && !inSpan(picture.span, scrolled, view.innerHeight, bandOf(picture.width)))
|
|
6087
|
+
again();
|
|
5252
6088
|
} catch {}
|
|
5253
6089
|
};
|
|
5254
6090
|
const paint = async () => {
|
|
@@ -5260,6 +6096,7 @@ function createUnderbar(glass, frame2) {
|
|
|
5260
6096
|
image?.remove();
|
|
5261
6097
|
image = null;
|
|
5262
6098
|
picture = null;
|
|
6099
|
+
dropCover();
|
|
5263
6100
|
return;
|
|
5264
6101
|
}
|
|
5265
6102
|
if (!changed && key === taken)
|
|
@@ -5269,22 +6106,36 @@ function createUnderbar(glass, frame2) {
|
|
|
5269
6106
|
const start = performance.now();
|
|
5270
6107
|
let next = null;
|
|
5271
6108
|
try {
|
|
5272
|
-
next = pictureOf(frame2);
|
|
6109
|
+
next = pictureOf(frame2, bandOf(frame2.contentWindow?.innerWidth ?? 0), again);
|
|
5273
6110
|
} catch {
|
|
5274
6111
|
next = null;
|
|
5275
6112
|
}
|
|
5276
6113
|
const fresh2 = new Image;
|
|
5277
6114
|
let drawn = false;
|
|
6115
|
+
let lifted = null;
|
|
5278
6116
|
if (next) {
|
|
5279
6117
|
fresh2.src = next.src;
|
|
5280
6118
|
drawn = await fresh2.decode().then(() => true, () => false);
|
|
6119
|
+
const above = next.overlay?.above;
|
|
6120
|
+
if (drawn && next.overlay && above) {
|
|
6121
|
+
const over2 = new Image;
|
|
6122
|
+
over2.src = above.src;
|
|
6123
|
+
const decoded = await over2.decode().then(() => true, () => false);
|
|
6124
|
+
lifted = decoded ? raiseOf(next.overlay, over2) : null;
|
|
6125
|
+
if (lifted)
|
|
6126
|
+
drawAbove(next.overlay, lifted);
|
|
6127
|
+
}
|
|
5281
6128
|
}
|
|
5282
6129
|
cost = performance.now() - start;
|
|
5283
6130
|
last = performance.now();
|
|
5284
6131
|
performance.measure("devknobs underbar picture", { start, duration: cost });
|
|
5285
6132
|
painting = false;
|
|
5286
|
-
if (!next || !drawn)
|
|
6133
|
+
if (!next || !drawn) {
|
|
6134
|
+
if (next?.overlay)
|
|
6135
|
+
next.overlay.canvas.width = 0;
|
|
6136
|
+
spend2(lifted);
|
|
5287
6137
|
return;
|
|
6138
|
+
}
|
|
5288
6139
|
fresh2.alt = "";
|
|
5289
6140
|
if (image)
|
|
5290
6141
|
image.replaceWith(fresh2);
|
|
@@ -5292,6 +6143,16 @@ function createUnderbar(glass, frame2) {
|
|
|
5292
6143
|
band.append(fresh2);
|
|
5293
6144
|
image = fresh2;
|
|
5294
6145
|
picture = next;
|
|
6146
|
+
dropCover();
|
|
6147
|
+
cover = next.overlay?.canvas ?? null;
|
|
6148
|
+
if (cover)
|
|
6149
|
+
band.append(cover);
|
|
6150
|
+
if (next.overlay?.live.length)
|
|
6151
|
+
raised = lifted;
|
|
6152
|
+
else
|
|
6153
|
+
spend2(lifted);
|
|
6154
|
+
if (next.overlay)
|
|
6155
|
+
follow4(next.overlay);
|
|
5295
6156
|
taken = key;
|
|
5296
6157
|
fit();
|
|
5297
6158
|
if (changed)
|
|
@@ -5308,6 +6169,11 @@ function createUnderbar(glass, frame2) {
|
|
|
5308
6169
|
return;
|
|
5309
6170
|
image.style.width = `${wide}px`;
|
|
5310
6171
|
image.style.height = `${picture.height * wide / picture.width}px`;
|
|
6172
|
+
if (cover && picture.overlay) {
|
|
6173
|
+
const { span } = picture.overlay;
|
|
6174
|
+
cover.style.width = `${wide}px`;
|
|
6175
|
+
cover.style.height = `${(span.bottom - span.top) * wide / picture.width}px`;
|
|
6176
|
+
}
|
|
5311
6177
|
move();
|
|
5312
6178
|
}
|
|
5313
6179
|
return {
|
|
@@ -5321,8 +6187,9 @@ function createUnderbar(glass, frame2) {
|
|
|
5321
6187
|
}
|
|
5322
6188
|
place(band, rect.x * zoom, rect.y * zoom, rect.width, rect.height);
|
|
5323
6189
|
wide = rect.width;
|
|
6190
|
+
high = rect.height;
|
|
5324
6191
|
band.style.transform = zoom === 1 ? "" : `scale(${zoom})`;
|
|
5325
|
-
band.style.background = look.background
|
|
6192
|
+
band.style.background = `linear-gradient(${look.background}, ${look.background})`;
|
|
5326
6193
|
const key = keyOf();
|
|
5327
6194
|
if (key !== taken || changed)
|
|
5328
6195
|
soon();
|
|
@@ -5337,7 +6204,12 @@ function createUnderbar(glass, frame2) {
|
|
|
5337
6204
|
clearTimeout(waiting);
|
|
5338
6205
|
observer?.disconnect();
|
|
5339
6206
|
observer = null;
|
|
6207
|
+
for (const type of LOADS)
|
|
6208
|
+
watched2?.removeEventListener(type, onLoad, true);
|
|
6209
|
+
watched2?.removeEventListener("scroll", onScroll, true);
|
|
5340
6210
|
watched2 = null;
|
|
6211
|
+
dropCover();
|
|
6212
|
+
forgetPixels();
|
|
5341
6213
|
band.remove();
|
|
5342
6214
|
}
|
|
5343
6215
|
};
|
|
@@ -5944,11 +6816,11 @@ function fit(knobs2, size, options = {}) {
|
|
|
5944
6816
|
const whole = Math.min(sized && tall ? ZOOM_MAX : 1, across, tall ? upright : 1);
|
|
5945
6817
|
const height = typeof knobs2.height === "number" ? knobs2.height : room.height / whole;
|
|
5946
6818
|
const outer = { width: width + sides.width, height: height + sides.height };
|
|
5947
|
-
const
|
|
5948
|
-
const loose =
|
|
6819
|
+
const covered2 = sized && aside > 0 && aside <= room.width / 2 && (room.width + outer.width * whole) / 2 + x > room.width - aside;
|
|
6820
|
+
const loose = covered2 ? Math.min(whole, (room.width - aside - 2 * x) / outer.width) : whole;
|
|
5949
6821
|
const fitted = mock === BARE ? loose : snapScale(loose, height, ratio);
|
|
5950
6822
|
const scale = knobs2.zoom === "fit" ? fitted : knobs2.zoom;
|
|
5951
|
-
const beside = knobs2.zoom === "fit" &&
|
|
6823
|
+
const beside = knobs2.zoom === "fit" && covered2 ? aside : 0;
|
|
5952
6824
|
const before = side === "left" ? beside : 0;
|
|
5953
6825
|
return {
|
|
5954
6826
|
width,
|
|
@@ -6270,7 +7142,7 @@ function hingeLine(pane, across, part) {
|
|
|
6270
7142
|
return pane === "inner" ? [-1 / width, 0, (x + width) / width] : [1 / width, 0, -x / width];
|
|
6271
7143
|
return pane === "inner" ? [0, 1 / height, -y / height] : [0, -1 / height, (y + height) / height];
|
|
6272
7144
|
}
|
|
6273
|
-
function
|
|
7145
|
+
function contextOf2(canvas) {
|
|
6274
7146
|
if (typeof WebGL2RenderingContext === "undefined")
|
|
6275
7147
|
return null;
|
|
6276
7148
|
const gl = canvas.getContext("webgl2", {
|
|
@@ -6388,11 +7260,11 @@ function uploadWhy(error) {
|
|
|
6388
7260
|
const tainted = "the browser holds the picture as another origin's, as one with a picture, video or canvas from another origin drawn in, or a drawing of the page this browser does not trust";
|
|
6389
7261
|
return `the picture could not be uploaded: ${name}${name === "SecurityError" ? `, ${tainted}` : ""}`;
|
|
6390
7262
|
}
|
|
6391
|
-
function screenGl(place2,
|
|
7263
|
+
function screenGl(place2, refused2) {
|
|
6392
7264
|
const canvas = document.createElement("canvas");
|
|
6393
|
-
const gl =
|
|
7265
|
+
const gl = contextOf2(canvas);
|
|
6394
7266
|
if (!gl) {
|
|
6395
|
-
|
|
7267
|
+
refused2(typeof WebGL2RenderingContext === "undefined" ? "this browser has no WebGL2" : "the canvas gave no WebGL2 context", null);
|
|
6396
7268
|
return null;
|
|
6397
7269
|
}
|
|
6398
7270
|
const rect = canvasRect(place2);
|
|
@@ -6423,7 +7295,7 @@ function screenGl(place2, refused) {
|
|
|
6423
7295
|
if (!vertex2 || !fragment || !program || !corners || !texture) {
|
|
6424
7296
|
const why = gl.isContextLost() ? "the WebGL2 context was lost as it was made" : "WebGL2 made no shader, program, buffer or texture";
|
|
6425
7297
|
free();
|
|
6426
|
-
|
|
7298
|
+
refused2(why, null);
|
|
6427
7299
|
return null;
|
|
6428
7300
|
}
|
|
6429
7301
|
gl.attachShader(program, vertex2);
|
|
@@ -6433,7 +7305,7 @@ function screenGl(place2, refused) {
|
|
|
6433
7305
|
const log = [vertex2, fragment].map((shader) => gl.getShaderInfoLog(shader)).find((said) => said?.trim()) ?? gl.getProgramInfoLog(program);
|
|
6434
7306
|
const lost = gl.isContextLost();
|
|
6435
7307
|
free();
|
|
6436
|
-
|
|
7308
|
+
refused2(lost ? "the WebGL2 context was lost as it was made" : `the shader did not compile or link: ${firstLine(log, "no reason given")}`, null);
|
|
6437
7309
|
return null;
|
|
6438
7310
|
}
|
|
6439
7311
|
gl.useProgram(program);
|
|
@@ -6485,31 +7357,31 @@ function screenGl(place2, refused) {
|
|
|
6485
7357
|
return;
|
|
6486
7358
|
gone = true;
|
|
6487
7359
|
canvas.remove();
|
|
6488
|
-
|
|
7360
|
+
refused2("the WebGL2 context was lost", shot);
|
|
6489
7361
|
});
|
|
6490
|
-
const
|
|
7362
|
+
const refuse2 = (why, next) => {
|
|
6491
7363
|
if (!gone)
|
|
6492
7364
|
free();
|
|
6493
7365
|
gone = true;
|
|
6494
|
-
|
|
7366
|
+
refused2(why, next);
|
|
6495
7367
|
};
|
|
6496
7368
|
return {
|
|
6497
7369
|
canvas,
|
|
6498
7370
|
paint(next) {
|
|
6499
7371
|
if (gone)
|
|
6500
|
-
return
|
|
7372
|
+
return refuse2("the WebGL2 context is gone", next);
|
|
6501
7373
|
if (Math.max(next.width, next.height) > widest) {
|
|
6502
|
-
return
|
|
7374
|
+
return refuse2(`the picture, ${next.width} by ${next.height} px, is larger than MAX_TEXTURE_SIZE, ${widest}`, next);
|
|
6503
7375
|
}
|
|
6504
7376
|
gl.getError();
|
|
6505
7377
|
try {
|
|
6506
7378
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, next);
|
|
6507
7379
|
} catch (error) {
|
|
6508
|
-
return
|
|
7380
|
+
return refuse2(uploadWhy(error), next);
|
|
6509
7381
|
}
|
|
6510
7382
|
const failed = gl.getError();
|
|
6511
7383
|
if (failed !== gl.NO_ERROR)
|
|
6512
|
-
return
|
|
7384
|
+
return refuse2(`the picture could not be uploaded: WebGL2 error 0x${failed.toString(16)}`, next);
|
|
6513
7385
|
gl.generateMipmap(gl.TEXTURE_2D);
|
|
6514
7386
|
shot = next;
|
|
6515
7387
|
if (look)
|
|
@@ -6527,7 +7399,7 @@ function screenGl(place2, refused) {
|
|
|
6527
7399
|
|
|
6528
7400
|
// src/engine/barshot.ts
|
|
6529
7401
|
var GLASS = "blur(10px) saturate(1.8)";
|
|
6530
|
-
var
|
|
7402
|
+
var REACH2 = 30;
|
|
6531
7403
|
var STILL_CSS = `
|
|
6532
7404
|
.browser { transform: none !important; }
|
|
6533
7405
|
.browser, .browser * {
|
|
@@ -6549,7 +7421,7 @@ function glassOf(bars, host) {
|
|
|
6549
7421
|
return bars.shapes.filter((shape) => shape.kind !== "field").map(({ x, y, width, height, radius }) => ({ rect: { x, y, width, height }, radius }));
|
|
6550
7422
|
}
|
|
6551
7423
|
const pill = bars.shapes.find((shape) => shape.kind === "pill");
|
|
6552
|
-
return pill ? [{ rect: pillBox(pill, host), radius: pill.radius }] : [];
|
|
7424
|
+
return pill ? [{ rect: pillBox(pill, host, turn(bars.screen, bars.orientation).width), radius: pill.radius }] : [];
|
|
6553
7425
|
}
|
|
6554
7426
|
function copyBars(shown2, value, size) {
|
|
6555
7427
|
const minimized = shown2.querySelector("[data-state]")?.getAttribute("data-state") === "min";
|
|
@@ -6587,8 +7459,8 @@ async function paintBars(shot, bars) {
|
|
|
6587
7459
|
pen.roundRect(rect.x, rect.y, rect.width, rect.height, radius);
|
|
6588
7460
|
pen.clip();
|
|
6589
7461
|
pen.filter = GLASS;
|
|
6590
|
-
const [x, y] = [rect.x -
|
|
6591
|
-
const [width, height] = [rect.width + 2 *
|
|
7462
|
+
const [x, y] = [rect.x - REACH2, rect.y - REACH2];
|
|
7463
|
+
const [width, height] = [rect.width + 2 * REACH2, rect.height + 2 * REACH2];
|
|
6592
7464
|
pen.drawImage(under, x * scale, y * scale, width * scale, height * scale, x, y, width, height);
|
|
6593
7465
|
pen.restore();
|
|
6594
7466
|
}
|
|
@@ -6965,12 +7837,12 @@ function pick(turning, open) {
|
|
|
6965
7837
|
const { at } = shownAt(shots2, ready, open);
|
|
6966
7838
|
const next = at === null ? null : shots2.frames[at];
|
|
6967
7839
|
const bitmap = at === null ? null : ready[at];
|
|
6968
|
-
const
|
|
7840
|
+
const kept4 = next && shots2.stills[next.still];
|
|
6969
7841
|
const keptBitmap = next && found?.stills[next.still];
|
|
6970
7842
|
if (next && bitmap && next !== plane.shot)
|
|
6971
7843
|
drawOn(plane, next, bitmap, shots2.scale);
|
|
6972
|
-
if (
|
|
6973
|
-
drawOn(turning.still,
|
|
7844
|
+
if (kept4 && keptBitmap && kept4 !== turning.still.shot)
|
|
7845
|
+
drawOn(turning.still, kept4, keptBitmap, shots2.scale);
|
|
6974
7846
|
return plane.shot ? shotOpen(plane.shot) : open;
|
|
6975
7847
|
}
|
|
6976
7848
|
function pose(turning, layout, open, shown2, still2) {
|
|
@@ -8494,7 +9366,7 @@ var bodyObserver = null;
|
|
|
8494
9366
|
function hide(node) {
|
|
8495
9367
|
if (!(node instanceof HTMLElement || node instanceof SVGElement))
|
|
8496
9368
|
return;
|
|
8497
|
-
if (node
|
|
9369
|
+
if (isMarked(node) || hidden.has(node))
|
|
8498
9370
|
return;
|
|
8499
9371
|
const style = node.style;
|
|
8500
9372
|
hidden.set(node, {
|
|
@@ -8525,7 +9397,7 @@ function holdModals() {
|
|
|
8525
9397
|
const native = HTMLDialogElement.prototype.showModal;
|
|
8526
9398
|
showModal = native;
|
|
8527
9399
|
HTMLDialogElement.prototype.showModal = function() {
|
|
8528
|
-
if (this.closest(
|
|
9400
|
+
if (this.closest(ownSelector()))
|
|
8529
9401
|
native.call(this);
|
|
8530
9402
|
else
|
|
8531
9403
|
this.show();
|
|
@@ -8535,7 +9407,7 @@ function holdModals() {
|
|
|
8535
9407
|
modals = Array.from(document.querySelectorAll("dialog:modal"));
|
|
8536
9408
|
} catch {}
|
|
8537
9409
|
for (const dialog of modals) {
|
|
8538
|
-
if (dialog.closest(
|
|
9410
|
+
if (dialog.closest(ownSelector()))
|
|
8539
9411
|
continue;
|
|
8540
9412
|
dialog.close();
|
|
8541
9413
|
dialog.show();
|
|
@@ -8879,7 +9751,7 @@ var latest2 = null;
|
|
|
8879
9751
|
var heading = "closed";
|
|
8880
9752
|
var settled = false;
|
|
8881
9753
|
var pending2 = null;
|
|
8882
|
-
var
|
|
9754
|
+
var covered2 = false;
|
|
8883
9755
|
var released = false;
|
|
8884
9756
|
function frameWindow() {
|
|
8885
9757
|
return frame3?.contentWindow ?? null;
|
|
@@ -9092,7 +9964,7 @@ function showZoom(place2) {
|
|
|
9092
9964
|
picker.value = String(zoom);
|
|
9093
9965
|
}
|
|
9094
9966
|
function panelWidth() {
|
|
9095
|
-
return document
|
|
9967
|
+
return findOwn(document, "panel")?.offsetWidth ?? 0;
|
|
9096
9968
|
}
|
|
9097
9969
|
function asideOf(panel) {
|
|
9098
9970
|
return panel.open && !panel.docked ? panelWidth() : 0;
|
|
@@ -9180,9 +10052,9 @@ function stageSize() {
|
|
|
9180
10052
|
return { width: Math.max(0, width), height: letterbox?.clientHeight ?? 0 };
|
|
9181
10053
|
}
|
|
9182
10054
|
function panelSized(glide) {
|
|
9183
|
-
const
|
|
10055
|
+
const pinned2 = current.panel.docked;
|
|
9184
10056
|
if (!glide) {
|
|
9185
|
-
if (!
|
|
10057
|
+
if (!pinned2)
|
|
9186
10058
|
resize();
|
|
9187
10059
|
else if (ride) {
|
|
9188
10060
|
endRide();
|
|
@@ -9193,7 +10065,7 @@ function panelSized(glide) {
|
|
|
9193
10065
|
if (following)
|
|
9194
10066
|
window.cancelAnimationFrame(following);
|
|
9195
10067
|
following = 0;
|
|
9196
|
-
if (
|
|
10068
|
+
if (pinned2)
|
|
9197
10069
|
follow4(resize);
|
|
9198
10070
|
else
|
|
9199
10071
|
glideFrame(screen, { first: false, from: current.panel, to: current.panel, sized: true }, resize);
|
|
@@ -9520,27 +10392,27 @@ function foldDevice2(value, held2 = false) {
|
|
|
9520
10392
|
}
|
|
9521
10393
|
function hidePage() {
|
|
9522
10394
|
const body = document.body;
|
|
9523
|
-
if (
|
|
10395
|
+
if (covered2 || !body)
|
|
9524
10396
|
return;
|
|
9525
|
-
|
|
10397
|
+
covered2 = true;
|
|
9526
10398
|
cover2(body);
|
|
9527
10399
|
const style = ensureStyle(NAME);
|
|
9528
|
-
style.textContent =
|
|
10400
|
+
style.textContent = `html{overflow:hidden!important}:popover-open:not(${ownSelector()}){display:none!important}`;
|
|
9529
10401
|
const node = styleNode(style);
|
|
9530
10402
|
if (node)
|
|
9531
10403
|
stopKeepingStyle = keepMounted(node, { home: () => document.head ?? document.documentElement });
|
|
9532
10404
|
}
|
|
9533
10405
|
function showPage() {
|
|
9534
|
-
if (!
|
|
10406
|
+
if (!covered2)
|
|
9535
10407
|
return;
|
|
9536
|
-
|
|
10408
|
+
covered2 = false;
|
|
9537
10409
|
stopKeepingStyle?.();
|
|
9538
10410
|
stopKeepingStyle = null;
|
|
9539
10411
|
uncover2();
|
|
9540
10412
|
removeStyle(NAME);
|
|
9541
10413
|
}
|
|
9542
10414
|
function remounted() {
|
|
9543
|
-
if (
|
|
10415
|
+
if (covered2) {
|
|
9544
10416
|
showPage();
|
|
9545
10417
|
hidePage();
|
|
9546
10418
|
}
|
|
@@ -9610,7 +10482,7 @@ function scene() {
|
|
|
9610
10482
|
screenRect,
|
|
9611
10483
|
fullRect,
|
|
9612
10484
|
scheme: coverScheme,
|
|
9613
|
-
covered: () =>
|
|
10485
|
+
covered: () => covered2,
|
|
9614
10486
|
hidePage,
|
|
9615
10487
|
painted,
|
|
9616
10488
|
layout,
|
|
@@ -9650,7 +10522,7 @@ function open(veiled, first) {
|
|
|
9650
10522
|
if (host || !needsFrame(current) || !body)
|
|
9651
10523
|
return;
|
|
9652
10524
|
host = document.createElement("div");
|
|
9653
|
-
host
|
|
10525
|
+
markOwn(host, "viewport");
|
|
9654
10526
|
host.style.cssText = `position:fixed;inset:0;z-index:${Z_INDEX}`;
|
|
9655
10527
|
const root = host.attachShadow({ mode: "open" });
|
|
9656
10528
|
addStyle(root, VIEWPORT_CSS);
|
|
@@ -9677,9 +10549,9 @@ function open(veiled, first) {
|
|
|
9677
10549
|
glass = document.createElement("div");
|
|
9678
10550
|
glass.className = "glass";
|
|
9679
10551
|
frame3 = document.createElement("iframe");
|
|
9680
|
-
frame3
|
|
10552
|
+
setMark(frame3, FRAME_ATTRIBUTE);
|
|
9681
10553
|
if (fresh())
|
|
9682
|
-
frame3
|
|
10554
|
+
setMark(frame3, FRESH_ATTRIBUTE);
|
|
9683
10555
|
frame3.name = FRAME_NAME;
|
|
9684
10556
|
frame3.title = "knobs viewport";
|
|
9685
10557
|
frame3.setAttribute("sandbox", SANDBOX);
|