@vinena/knobs 0.6.3 → 0.6.5
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 +10 -0
- package/dist/early.global.js +5 -5
- package/dist/{elementsview-05qybwpn.js → elementsview-s5vj51vh.js} +11 -11
- package/dist/{elementsview-gjaqje2k.js → elementsview-swft4xar.js} +11 -11
- package/dist/engine/media.d.ts +3 -2
- package/dist/engine/shotmedia.d.ts +50 -0
- package/dist/{framekit-3bmkm34m.js → framekit-q97zeg1d.js} +149 -9
- package/dist/{framekit-h0jrc5gs.js → framekit-rjk9fs3v.js} +149 -9
- package/dist/grab/overlay.d.ts +10 -1
- package/dist/{index-fp1h37b3.js → index-20bc9yrj.js} +1 -1
- package/dist/{index-0yn3rnza.js → index-69fvtkcm.js} +6 -6
- package/dist/{index-zd6adby9.js → index-a8ffw5ft.js} +1 -1
- package/dist/{index-gm51cthv.js → index-ajs4na3f.js} +1 -1
- package/dist/{index-4192t60e.js → index-df35z48z.js} +2 -2
- package/dist/{index-6xsvcjnc.js → index-dxga6h10.js} +4 -4
- package/dist/{index-dzm8ywq0.js → index-jfv7vavj.js} +3 -20
- package/dist/{index-kpsrkzmf.js → index-pwqfmbqm.js} +4 -4
- package/dist/{index-509g0pa8.js → index-s252g4k2.js} +5 -5
- package/dist/{index-7cb4x1vj.js → index-s6yzsvs4.js} +1 -1
- package/dist/{index-aj1z83rt.js → index-sy63y6r7.js} +9 -9
- package/dist/{index-0mav2k60.js → index-whbpf3kg.js} +9 -9
- package/dist/{index-rdssc7sz.js → index-whehz74d.js} +1 -1
- package/dist/{index-h93t2tc5.js → index-yc2m7nce.js} +6 -6
- package/dist/{index-xh39jtkq.js → index-ymqm185m.js} +1 -1
- package/dist/{index-ftjdt358.js → index-za4ppxay.js} +1 -1
- package/dist/index.global.js +125 -119
- package/dist/index.js +15 -15
- package/dist/{react-wqn4sx0n.js → react-0r5418av.js} +3 -20
- package/dist/{react-r3zf2djn.js → react-2b7725je.js} +4 -4
- package/dist/{react-ethftdxp.js → react-4phtr2nd.js} +1 -1
- package/dist/{react-pvmjybgw.js → react-5ekfj7g3.js} +2 -2
- package/dist/{react-ttj8f9qp.js → react-5h7pxnax.js} +1 -1
- package/dist/{react-6fnxxs30.js → react-73reavv4.js} +1 -1
- package/dist/{react-me102s1a.js → react-k4pkm1p5.js} +1 -1
- package/dist/{react-anqpcaqm.js → react-msn10fjb.js} +6 -6
- package/dist/{react-gkzn5n3v.js → react-nc8fzgmc.js} +5 -5
- package/dist/{react-x1ndxf29.js → react-p1m2eadn.js} +6 -6
- package/dist/{react-2381cr3w.js → react-smtqyzx0.js} +4 -4
- package/dist/{react-4ykd817s.js → react-vbk58f9m.js} +1 -1
- package/dist/{react-4rbjw9af.js → react-wtgvkf6g.js} +1 -1
- package/dist/{react-ptamex0p.js → react-y9gr8yt2.js} +1 -1
- package/dist/react.js +15 -15
- package/dist/{replay-39ssrcqp.js → replay-461gcdh1.js} +7 -7
- package/dist/{replay-xacjqqt5.js → replay-ehgxp9py.js} +7 -7
- package/dist/{storageview-3gnncmmv.js → storageview-vtvt76ze.js} +6 -6
- package/dist/{storageview-dwsnvz36.js → storageview-yyd57vzw.js} +6 -6
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
turnOf,
|
|
25
25
|
turnedPose,
|
|
26
26
|
windowRect
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-ajs4na3f.js";
|
|
28
28
|
import {
|
|
29
29
|
hush,
|
|
30
30
|
hushOnce,
|
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
uaPreset,
|
|
83
83
|
userAgentOf,
|
|
84
84
|
viewportOf
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-s6yzsvs4.js";
|
|
86
86
|
import {
|
|
87
87
|
FRAME_ATTRIBUTE,
|
|
88
88
|
FRAME_NAME,
|
|
@@ -104,6 +104,7 @@ import {
|
|
|
104
104
|
hasTouch,
|
|
105
105
|
loads,
|
|
106
106
|
luminance,
|
|
107
|
+
mentionsFeature,
|
|
107
108
|
merge,
|
|
108
109
|
needsFrame,
|
|
109
110
|
openOf,
|
|
@@ -115,13 +116,15 @@ import {
|
|
|
115
116
|
post,
|
|
116
117
|
readMessage,
|
|
117
118
|
removeStyle,
|
|
119
|
+
rewriteMediaText,
|
|
118
120
|
screenOf,
|
|
119
121
|
stepZoom,
|
|
120
122
|
still,
|
|
121
123
|
styleNode,
|
|
122
124
|
turn,
|
|
125
|
+
walkRules,
|
|
123
126
|
wheelZoom
|
|
124
|
-
} from "./index-
|
|
127
|
+
} from "./index-jfv7vavj.js";
|
|
125
128
|
import"./index-a974q3aa.js";
|
|
126
129
|
import {
|
|
127
130
|
__export
|
|
@@ -4587,6 +4590,113 @@ function forgetFonts() {
|
|
|
4587
4590
|
kept2 = null;
|
|
4588
4591
|
}
|
|
4589
4592
|
|
|
4593
|
+
// src/engine/shotmedia.ts
|
|
4594
|
+
var VALUES = [
|
|
4595
|
+
["prefers-color-scheme", ["light", "dark"]],
|
|
4596
|
+
["prefers-reduced-motion", ["reduce", "no-preference"]],
|
|
4597
|
+
["prefers-contrast", ["more", "less", "custom", "no-preference"]],
|
|
4598
|
+
["prefers-reduced-transparency", ["reduce", "no-preference"]],
|
|
4599
|
+
["pointer", ["none", "coarse", "fine"]],
|
|
4600
|
+
["any-pointer", ["none", "coarse", "fine"]],
|
|
4601
|
+
["hover", ["none", "hover"]],
|
|
4602
|
+
["any-hover", ["none", "hover"]]
|
|
4603
|
+
];
|
|
4604
|
+
function frameMedia(view) {
|
|
4605
|
+
const read = [];
|
|
4606
|
+
for (const [feature, values] of VALUES) {
|
|
4607
|
+
try {
|
|
4608
|
+
const matched = values.filter((value) => view.matchMedia(`(${feature}: ${value})`).matches);
|
|
4609
|
+
if (matched.length === 1 && matched[0])
|
|
4610
|
+
read.push([feature, matched[0]]);
|
|
4611
|
+
} catch {}
|
|
4612
|
+
}
|
|
4613
|
+
return read;
|
|
4614
|
+
}
|
|
4615
|
+
function prefixedNamespace(text) {
|
|
4616
|
+
return /^@namespace\s+(?!url\(|["'])\S/i.test(text);
|
|
4617
|
+
}
|
|
4618
|
+
function eitherScheme(value) {
|
|
4619
|
+
return /\blight\b/.test(value) && /\bdark\b/.test(value);
|
|
4620
|
+
}
|
|
4621
|
+
function fixed(value, scheme) {
|
|
4622
|
+
return /\bonly\b/.test(value) ? `${scheme} only` : scheme;
|
|
4623
|
+
}
|
|
4624
|
+
function eachStyle(rules, visit) {
|
|
4625
|
+
for (const rule of Array.from(rules)) {
|
|
4626
|
+
const style = rule.style;
|
|
4627
|
+
if (style)
|
|
4628
|
+
visit(style);
|
|
4629
|
+
const children = rule.cssRules;
|
|
4630
|
+
if (children && children !== rules)
|
|
4631
|
+
eachStyle(children, visit);
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
function freezeMedia(rules, read, Sheet) {
|
|
4635
|
+
const scheme = read.find(([feature]) => feature === "prefers-color-scheme")?.[1];
|
|
4636
|
+
const schemed = (text) => scheme !== undefined && text.includes("color-scheme");
|
|
4637
|
+
if (read.length === 0)
|
|
4638
|
+
return { rules, computed: false };
|
|
4639
|
+
if (typeof Sheet?.prototype?.replaceSync !== "function")
|
|
4640
|
+
return { rules, computed: rules.some(schemed) };
|
|
4641
|
+
const namespaces = rules.filter(prefixedNamespace).join(`
|
|
4642
|
+
`);
|
|
4643
|
+
let computed = false;
|
|
4644
|
+
const frozen = rules.map((text) => {
|
|
4645
|
+
if (!(text.includes("@media") && mentionsFeature(text)) && !schemed(text))
|
|
4646
|
+
return text;
|
|
4647
|
+
try {
|
|
4648
|
+
const sheet = new Sheet;
|
|
4649
|
+
sheet.replaceSync(namespaces ? `${namespaces}
|
|
4650
|
+
${text}` : text);
|
|
4651
|
+
const parsed = Array.from(sheet.cssRules).filter((rule) => !rule.cssText.startsWith("@namespace"));
|
|
4652
|
+
if (parsed.length === 0)
|
|
4653
|
+
return text;
|
|
4654
|
+
walkRules(sheet.cssRules, (rule) => {
|
|
4655
|
+
let query = rule.media.mediaText;
|
|
4656
|
+
for (const [feature, value] of read)
|
|
4657
|
+
query = rewriteMediaText(query, feature, value);
|
|
4658
|
+
if (query !== rule.media.mediaText)
|
|
4659
|
+
rule.media.mediaText = query;
|
|
4660
|
+
}, new Set);
|
|
4661
|
+
if (scheme) {
|
|
4662
|
+
eachStyle(sheet.cssRules, (style) => {
|
|
4663
|
+
const value = style.getPropertyValue("color-scheme");
|
|
4664
|
+
if (value.includes("var("))
|
|
4665
|
+
computed = true;
|
|
4666
|
+
else if (eitherScheme(value)) {
|
|
4667
|
+
style.setProperty("color-scheme", fixed(value, scheme), style.getPropertyPriority("color-scheme"));
|
|
4668
|
+
}
|
|
4669
|
+
});
|
|
4670
|
+
}
|
|
4671
|
+
return parsed.map((rule) => rule.cssText).join(`
|
|
4672
|
+
`);
|
|
4673
|
+
} catch {
|
|
4674
|
+
if (schemed(text))
|
|
4675
|
+
computed = true;
|
|
4676
|
+
return text;
|
|
4677
|
+
}
|
|
4678
|
+
});
|
|
4679
|
+
return { rules: frozen, computed };
|
|
4680
|
+
}
|
|
4681
|
+
function schemePins(doc, view, scheme, computed) {
|
|
4682
|
+
const root = doc.documentElement;
|
|
4683
|
+
const schemeOf = (node) => view.getComputedStyle(node).getPropertyValue("color-scheme");
|
|
4684
|
+
let top = schemeOf(root);
|
|
4685
|
+
if (top === "normal" || top === "") {
|
|
4686
|
+
top = doc.querySelector('meta[name="color-scheme"]')?.getAttribute("content") ?? top;
|
|
4687
|
+
}
|
|
4688
|
+
const inline = new Set(doc.querySelectorAll('[style*="color-scheme"]'));
|
|
4689
|
+
if (!computed && inline.size === 0 && !eitherScheme(top))
|
|
4690
|
+
return null;
|
|
4691
|
+
return (node) => {
|
|
4692
|
+
const value = node === root ? top : computed || inline.has(node) ? schemeOf(node) : "";
|
|
4693
|
+
return eitherScheme(value) ? fixed(value, scheme) : null;
|
|
4694
|
+
};
|
|
4695
|
+
}
|
|
4696
|
+
function pinScheme(node, scheme) {
|
|
4697
|
+
node.setAttribute("style", `${node.getAttribute("style") ?? ""};color-scheme:${scheme} !important`);
|
|
4698
|
+
}
|
|
4699
|
+
|
|
4590
4700
|
// src/engine/pageshot.ts
|
|
4591
4701
|
var RES = 0.25;
|
|
4592
4702
|
var MOST = 1500;
|
|
@@ -4880,30 +4990,60 @@ function copyPage(frame2, leave) {
|
|
|
4880
4990
|
const doc = frame2.contentDocument;
|
|
4881
4991
|
if (!doc?.documentElement)
|
|
4882
4992
|
return null;
|
|
4993
|
+
const namespaces = [];
|
|
4883
4994
|
const rules = [];
|
|
4884
4995
|
const written2 = embedFonts(doc);
|
|
4885
4996
|
for (const sheet of [...doc.styleSheets, ...doc.adoptedStyleSheets ?? []]) {
|
|
4886
4997
|
try {
|
|
4887
|
-
|
|
4888
|
-
|
|
4998
|
+
const own = [];
|
|
4999
|
+
for (const rule of sheet.cssRules) {
|
|
5000
|
+
const text = written2(rule);
|
|
5001
|
+
if (!text.startsWith("@namespace"))
|
|
5002
|
+
own.push(text);
|
|
5003
|
+
else if (prefixedNamespace(text))
|
|
5004
|
+
namespaces.push(text);
|
|
5005
|
+
}
|
|
5006
|
+
const media = sheet.media?.mediaText ?? "";
|
|
5007
|
+
if (own.length > 0 && media !== "" && media !== "all")
|
|
5008
|
+
rules.push(`@media ${media} {
|
|
5009
|
+
${own.join(`
|
|
5010
|
+
`)}
|
|
5011
|
+
}`);
|
|
5012
|
+
else
|
|
5013
|
+
rules.push(...own);
|
|
4889
5014
|
} catch {}
|
|
4890
5015
|
}
|
|
5016
|
+
const view = doc.defaultView;
|
|
5017
|
+
const read = view ? frameMedia(view) : [];
|
|
5018
|
+
const frozen = freezeMedia([...namespaces, ...rules], read, view?.CSSStyleSheet);
|
|
5019
|
+
const scheme = read.find(([feature]) => feature === "prefers-color-scheme")?.[1];
|
|
5020
|
+
const pinned = view && scheme ? schemePins(doc, view, scheme, frozen.computed) : null;
|
|
5021
|
+
const pin = (node, copy) => {
|
|
5022
|
+
const to = pinned?.(node);
|
|
5023
|
+
if (to)
|
|
5024
|
+
pinScheme(copy, to);
|
|
5025
|
+
};
|
|
4891
5026
|
const inert = doc.implementation.createHTMLDocument("");
|
|
4892
5027
|
const root = inert.importNode(doc.documentElement, true);
|
|
4893
|
-
|
|
5028
|
+
pin(doc.documentElement, root);
|
|
5029
|
+
if (leave || pinned) {
|
|
4894
5030
|
const live = doc.documentElement.getElementsByTagName("*");
|
|
4895
5031
|
const copied = root.getElementsByTagName("*");
|
|
4896
5032
|
for (let index = 0;index < live.length; index++) {
|
|
4897
5033
|
const node = live[index];
|
|
4898
|
-
|
|
4899
|
-
|
|
5034
|
+
const copy = copied[index];
|
|
5035
|
+
if (!node || !copy)
|
|
5036
|
+
continue;
|
|
5037
|
+
if (leave?.(node))
|
|
5038
|
+
copy.setAttribute("data-devknobs", "");
|
|
5039
|
+
pin(node, copy);
|
|
4900
5040
|
}
|
|
4901
5041
|
}
|
|
4902
5042
|
blankPictures(doc.documentElement, root);
|
|
4903
5043
|
for (const node of root.querySelectorAll("script, link, style, noscript, [data-devknobs]"))
|
|
4904
5044
|
node.remove();
|
|
4905
5045
|
const style = inert.createElement("style");
|
|
4906
|
-
style.textContent = rules.join(`
|
|
5046
|
+
style.textContent = frozen.rules.join(`
|
|
4907
5047
|
`);
|
|
4908
5048
|
(root.querySelector("head") ?? root).append(style);
|
|
4909
5049
|
return root;
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
turnOf,
|
|
26
26
|
turnedPose,
|
|
27
27
|
windowRect
|
|
28
|
-
} from "./react-
|
|
28
|
+
} from "./react-k4pkm1p5.js";
|
|
29
29
|
import {
|
|
30
30
|
hush,
|
|
31
31
|
hushOnce,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
uaPreset,
|
|
84
84
|
userAgentOf,
|
|
85
85
|
viewportOf
|
|
86
|
-
} from "./react-
|
|
86
|
+
} from "./react-5h7pxnax.js";
|
|
87
87
|
import {
|
|
88
88
|
FRAME_ATTRIBUTE,
|
|
89
89
|
FRAME_NAME,
|
|
@@ -105,6 +105,7 @@ import {
|
|
|
105
105
|
hasTouch,
|
|
106
106
|
loads,
|
|
107
107
|
luminance,
|
|
108
|
+
mentionsFeature,
|
|
108
109
|
merge,
|
|
109
110
|
needsFrame,
|
|
110
111
|
openOf,
|
|
@@ -116,13 +117,15 @@ import {
|
|
|
116
117
|
post,
|
|
117
118
|
readMessage,
|
|
118
119
|
removeStyle,
|
|
120
|
+
rewriteMediaText,
|
|
119
121
|
screenOf,
|
|
120
122
|
stepZoom,
|
|
121
123
|
still,
|
|
122
124
|
styleNode,
|
|
123
125
|
turn,
|
|
126
|
+
walkRules,
|
|
124
127
|
wheelZoom
|
|
125
|
-
} from "./react-
|
|
128
|
+
} from "./react-0r5418av.js";
|
|
126
129
|
import"./react-fp73vhyd.js";
|
|
127
130
|
import {
|
|
128
131
|
__export
|
|
@@ -4588,6 +4591,113 @@ function forgetFonts() {
|
|
|
4588
4591
|
kept2 = null;
|
|
4589
4592
|
}
|
|
4590
4593
|
|
|
4594
|
+
// src/engine/shotmedia.ts
|
|
4595
|
+
var VALUES = [
|
|
4596
|
+
["prefers-color-scheme", ["light", "dark"]],
|
|
4597
|
+
["prefers-reduced-motion", ["reduce", "no-preference"]],
|
|
4598
|
+
["prefers-contrast", ["more", "less", "custom", "no-preference"]],
|
|
4599
|
+
["prefers-reduced-transparency", ["reduce", "no-preference"]],
|
|
4600
|
+
["pointer", ["none", "coarse", "fine"]],
|
|
4601
|
+
["any-pointer", ["none", "coarse", "fine"]],
|
|
4602
|
+
["hover", ["none", "hover"]],
|
|
4603
|
+
["any-hover", ["none", "hover"]]
|
|
4604
|
+
];
|
|
4605
|
+
function frameMedia(view) {
|
|
4606
|
+
const read = [];
|
|
4607
|
+
for (const [feature, values] of VALUES) {
|
|
4608
|
+
try {
|
|
4609
|
+
const matched = values.filter((value) => view.matchMedia(`(${feature}: ${value})`).matches);
|
|
4610
|
+
if (matched.length === 1 && matched[0])
|
|
4611
|
+
read.push([feature, matched[0]]);
|
|
4612
|
+
} catch {}
|
|
4613
|
+
}
|
|
4614
|
+
return read;
|
|
4615
|
+
}
|
|
4616
|
+
function prefixedNamespace(text) {
|
|
4617
|
+
return /^@namespace\s+(?!url\(|["'])\S/i.test(text);
|
|
4618
|
+
}
|
|
4619
|
+
function eitherScheme(value) {
|
|
4620
|
+
return /\blight\b/.test(value) && /\bdark\b/.test(value);
|
|
4621
|
+
}
|
|
4622
|
+
function fixed(value, scheme) {
|
|
4623
|
+
return /\bonly\b/.test(value) ? `${scheme} only` : scheme;
|
|
4624
|
+
}
|
|
4625
|
+
function eachStyle(rules, visit) {
|
|
4626
|
+
for (const rule of Array.from(rules)) {
|
|
4627
|
+
const style = rule.style;
|
|
4628
|
+
if (style)
|
|
4629
|
+
visit(style);
|
|
4630
|
+
const children = rule.cssRules;
|
|
4631
|
+
if (children && children !== rules)
|
|
4632
|
+
eachStyle(children, visit);
|
|
4633
|
+
}
|
|
4634
|
+
}
|
|
4635
|
+
function freezeMedia(rules, read, Sheet) {
|
|
4636
|
+
const scheme = read.find(([feature]) => feature === "prefers-color-scheme")?.[1];
|
|
4637
|
+
const schemed = (text) => scheme !== undefined && text.includes("color-scheme");
|
|
4638
|
+
if (read.length === 0)
|
|
4639
|
+
return { rules, computed: false };
|
|
4640
|
+
if (typeof Sheet?.prototype?.replaceSync !== "function")
|
|
4641
|
+
return { rules, computed: rules.some(schemed) };
|
|
4642
|
+
const namespaces = rules.filter(prefixedNamespace).join(`
|
|
4643
|
+
`);
|
|
4644
|
+
let computed = false;
|
|
4645
|
+
const frozen = rules.map((text) => {
|
|
4646
|
+
if (!(text.includes("@media") && mentionsFeature(text)) && !schemed(text))
|
|
4647
|
+
return text;
|
|
4648
|
+
try {
|
|
4649
|
+
const sheet = new Sheet;
|
|
4650
|
+
sheet.replaceSync(namespaces ? `${namespaces}
|
|
4651
|
+
${text}` : text);
|
|
4652
|
+
const parsed = Array.from(sheet.cssRules).filter((rule) => !rule.cssText.startsWith("@namespace"));
|
|
4653
|
+
if (parsed.length === 0)
|
|
4654
|
+
return text;
|
|
4655
|
+
walkRules(sheet.cssRules, (rule) => {
|
|
4656
|
+
let query = rule.media.mediaText;
|
|
4657
|
+
for (const [feature, value] of read)
|
|
4658
|
+
query = rewriteMediaText(query, feature, value);
|
|
4659
|
+
if (query !== rule.media.mediaText)
|
|
4660
|
+
rule.media.mediaText = query;
|
|
4661
|
+
}, new Set);
|
|
4662
|
+
if (scheme) {
|
|
4663
|
+
eachStyle(sheet.cssRules, (style) => {
|
|
4664
|
+
const value = style.getPropertyValue("color-scheme");
|
|
4665
|
+
if (value.includes("var("))
|
|
4666
|
+
computed = true;
|
|
4667
|
+
else if (eitherScheme(value)) {
|
|
4668
|
+
style.setProperty("color-scheme", fixed(value, scheme), style.getPropertyPriority("color-scheme"));
|
|
4669
|
+
}
|
|
4670
|
+
});
|
|
4671
|
+
}
|
|
4672
|
+
return parsed.map((rule) => rule.cssText).join(`
|
|
4673
|
+
`);
|
|
4674
|
+
} catch {
|
|
4675
|
+
if (schemed(text))
|
|
4676
|
+
computed = true;
|
|
4677
|
+
return text;
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
return { rules: frozen, computed };
|
|
4681
|
+
}
|
|
4682
|
+
function schemePins(doc, view, scheme, computed) {
|
|
4683
|
+
const root = doc.documentElement;
|
|
4684
|
+
const schemeOf = (node) => view.getComputedStyle(node).getPropertyValue("color-scheme");
|
|
4685
|
+
let top = schemeOf(root);
|
|
4686
|
+
if (top === "normal" || top === "") {
|
|
4687
|
+
top = doc.querySelector('meta[name="color-scheme"]')?.getAttribute("content") ?? top;
|
|
4688
|
+
}
|
|
4689
|
+
const inline = new Set(doc.querySelectorAll('[style*="color-scheme"]'));
|
|
4690
|
+
if (!computed && inline.size === 0 && !eitherScheme(top))
|
|
4691
|
+
return null;
|
|
4692
|
+
return (node) => {
|
|
4693
|
+
const value = node === root ? top : computed || inline.has(node) ? schemeOf(node) : "";
|
|
4694
|
+
return eitherScheme(value) ? fixed(value, scheme) : null;
|
|
4695
|
+
};
|
|
4696
|
+
}
|
|
4697
|
+
function pinScheme(node, scheme) {
|
|
4698
|
+
node.setAttribute("style", `${node.getAttribute("style") ?? ""};color-scheme:${scheme} !important`);
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4591
4701
|
// src/engine/pageshot.ts
|
|
4592
4702
|
var RES = 0.25;
|
|
4593
4703
|
var MOST = 1500;
|
|
@@ -4881,30 +4991,60 @@ function copyPage(frame2, leave) {
|
|
|
4881
4991
|
const doc = frame2.contentDocument;
|
|
4882
4992
|
if (!doc?.documentElement)
|
|
4883
4993
|
return null;
|
|
4994
|
+
const namespaces = [];
|
|
4884
4995
|
const rules = [];
|
|
4885
4996
|
const written2 = embedFonts(doc);
|
|
4886
4997
|
for (const sheet of [...doc.styleSheets, ...doc.adoptedStyleSheets ?? []]) {
|
|
4887
4998
|
try {
|
|
4888
|
-
|
|
4889
|
-
|
|
4999
|
+
const own = [];
|
|
5000
|
+
for (const rule of sheet.cssRules) {
|
|
5001
|
+
const text = written2(rule);
|
|
5002
|
+
if (!text.startsWith("@namespace"))
|
|
5003
|
+
own.push(text);
|
|
5004
|
+
else if (prefixedNamespace(text))
|
|
5005
|
+
namespaces.push(text);
|
|
5006
|
+
}
|
|
5007
|
+
const media = sheet.media?.mediaText ?? "";
|
|
5008
|
+
if (own.length > 0 && media !== "" && media !== "all")
|
|
5009
|
+
rules.push(`@media ${media} {
|
|
5010
|
+
${own.join(`
|
|
5011
|
+
`)}
|
|
5012
|
+
}`);
|
|
5013
|
+
else
|
|
5014
|
+
rules.push(...own);
|
|
4890
5015
|
} catch {}
|
|
4891
5016
|
}
|
|
5017
|
+
const view = doc.defaultView;
|
|
5018
|
+
const read = view ? frameMedia(view) : [];
|
|
5019
|
+
const frozen = freezeMedia([...namespaces, ...rules], read, view?.CSSStyleSheet);
|
|
5020
|
+
const scheme = read.find(([feature]) => feature === "prefers-color-scheme")?.[1];
|
|
5021
|
+
const pinned = view && scheme ? schemePins(doc, view, scheme, frozen.computed) : null;
|
|
5022
|
+
const pin = (node, copy) => {
|
|
5023
|
+
const to = pinned?.(node);
|
|
5024
|
+
if (to)
|
|
5025
|
+
pinScheme(copy, to);
|
|
5026
|
+
};
|
|
4892
5027
|
const inert = doc.implementation.createHTMLDocument("");
|
|
4893
5028
|
const root = inert.importNode(doc.documentElement, true);
|
|
4894
|
-
|
|
5029
|
+
pin(doc.documentElement, root);
|
|
5030
|
+
if (leave || pinned) {
|
|
4895
5031
|
const live = doc.documentElement.getElementsByTagName("*");
|
|
4896
5032
|
const copied = root.getElementsByTagName("*");
|
|
4897
5033
|
for (let index = 0;index < live.length; index++) {
|
|
4898
5034
|
const node = live[index];
|
|
4899
|
-
|
|
4900
|
-
|
|
5035
|
+
const copy = copied[index];
|
|
5036
|
+
if (!node || !copy)
|
|
5037
|
+
continue;
|
|
5038
|
+
if (leave?.(node))
|
|
5039
|
+
copy.setAttribute("data-devknobs", "");
|
|
5040
|
+
pin(node, copy);
|
|
4901
5041
|
}
|
|
4902
5042
|
}
|
|
4903
5043
|
blankPictures(doc.documentElement, root);
|
|
4904
5044
|
for (const node of root.querySelectorAll("script, link, style, noscript, [data-devknobs]"))
|
|
4905
5045
|
node.remove();
|
|
4906
5046
|
const style = inert.createElement("style");
|
|
4907
|
-
style.textContent = rules.join(`
|
|
5047
|
+
style.textContent = frozen.rules.join(`
|
|
4908
5048
|
`);
|
|
4909
5049
|
(root.querySelector("head") ?? root).append(style);
|
|
4910
5050
|
return root;
|
package/dist/grab/overlay.d.ts
CHANGED
|
@@ -5,6 +5,13 @@ export declare const LERP = 0.3;
|
|
|
5
5
|
export declare const HIDE_WAIT = 100;
|
|
6
6
|
/** How long the toast stays, and the box with it, in ms. */
|
|
7
7
|
export declare const TOAST_TIME = 1500;
|
|
8
|
+
/**
|
|
9
|
+
* One color for the boxes and the glow, wider where the screen shows P3: the
|
|
10
|
+
* one picked, one of the user's own too, or a blue, and a green where the page
|
|
11
|
+
* is blue. The label goes
|
|
12
|
+
* by the page: light on a dark one, dark on a light one.
|
|
13
|
+
*/
|
|
14
|
+
export declare const CSS: string;
|
|
8
15
|
/**
|
|
9
16
|
* One frame of some numbers on their way to their targets, `elapsed` ms after
|
|
10
17
|
* the last. The same share of what is left goes each 60th of a second,
|
|
@@ -88,7 +95,9 @@ export declare function snap(value: number, ratio: number): number;
|
|
|
88
95
|
* the fill between them in three. The corners keep their size and only move.
|
|
89
96
|
* The lines and the fills are one device pixel of one color, stretched by
|
|
90
97
|
* whole ones: the browser puts a box on device pixels before it scales it, so
|
|
91
|
-
* one px stretched leaves gaps where a px is not a whole number of them.
|
|
98
|
+
* one px stretched leaves gaps where a px is not a whole number of them. A
|
|
99
|
+
* stretched piece must not be its own layer: the browser rounds the layer's
|
|
100
|
+
* size up, and the stretch makes that rounding grow with it. No
|
|
92
101
|
* two pieces overlap, and every side is on a whole device pixel, so they meet
|
|
93
102
|
* with no seam. The radius is not the shape's own, which is on its way: each
|
|
94
103
|
* new one paints the corners again, so the box takes its element's at once.
|
|
@@ -5,32 +5,32 @@ import {
|
|
|
5
5
|
riskyElement,
|
|
6
6
|
specificity,
|
|
7
7
|
splitList
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-df35z48z.js";
|
|
9
9
|
import {
|
|
10
10
|
middle
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-za4ppxay.js";
|
|
12
12
|
import {
|
|
13
13
|
NEW_RULE_SHEET,
|
|
14
14
|
isNewRuleSheet,
|
|
15
15
|
isShadowRoot,
|
|
16
16
|
label
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-a8ffw5ft.js";
|
|
18
18
|
import {
|
|
19
19
|
actButton,
|
|
20
20
|
el
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-20bc9yrj.js";
|
|
22
22
|
import {
|
|
23
23
|
icon,
|
|
24
24
|
isDevknobs,
|
|
25
25
|
typesInField
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-whehz74d.js";
|
|
27
27
|
import {
|
|
28
28
|
addStyle,
|
|
29
29
|
authoredQuery,
|
|
30
30
|
ensureStyle,
|
|
31
31
|
isDocument,
|
|
32
32
|
isOwnSheet
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-jfv7vavj.js";
|
|
34
34
|
|
|
35
35
|
// src/styles/collect.ts
|
|
36
36
|
function isKind(rule, kind) {
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
realNow,
|
|
4
4
|
stamped,
|
|
5
5
|
webStorage
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-jfv7vavj.js";
|
|
7
7
|
import {
|
|
8
8
|
__require
|
|
9
9
|
} from "./index-5tv6sr74.js";
|
|
@@ -408,7 +408,7 @@ function settled(view, quiet = QUIET, longest = SETTLE_MAX) {
|
|
|
408
408
|
}
|
|
409
409
|
function createKeeper(options) {
|
|
410
410
|
const { log, store, view } = options;
|
|
411
|
-
const loadReplay = options.replay ?? (() => import("./replay-
|
|
411
|
+
const loadReplay = options.replay ?? (() => import("./replay-ehgxp9py.js").then(({ replayEdits }) => replayEdits));
|
|
412
412
|
const wait = options.settled ?? (() => settled(view));
|
|
413
413
|
const frame = options.frame ?? (() => null);
|
|
414
414
|
const ours = new WeakMap;
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
resolveNesting,
|
|
7
7
|
splitList
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-df35z48z.js";
|
|
9
9
|
import {
|
|
10
10
|
flatParent,
|
|
11
11
|
isNewRuleSheet,
|
|
12
12
|
isShadowRoot,
|
|
13
13
|
scopeOf
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-a8ffw5ft.js";
|
|
15
15
|
import {
|
|
16
16
|
isDevknobs
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-whehz74d.js";
|
|
18
18
|
import {
|
|
19
19
|
addStyle,
|
|
20
20
|
ensureStyle,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
stamped,
|
|
26
26
|
versionOf,
|
|
27
27
|
webStorage
|
|
28
|
-
} from "./index-
|
|
28
|
+
} from "./index-jfv7vavj.js";
|
|
29
29
|
|
|
30
30
|
// src/styles/force.ts
|
|
31
31
|
var FORCED_STATES = ["hover", "focus", "focus-visible", "active", "focus-within"];
|
|
@@ -2180,8 +2180,7 @@ var SYSTEM_MEDIA = {
|
|
|
2180
2180
|
touch: false
|
|
2181
2181
|
};
|
|
2182
2182
|
var TRUE_TOKEN = "(min-width: 0px)";
|
|
2183
|
-
var
|
|
2184
|
-
var FALSE_QUERY = "not all";
|
|
2183
|
+
var FALSE_TOKEN = "(not (min-width: 0px))";
|
|
2185
2184
|
var FEATURE_OF = {
|
|
2186
2185
|
scheme: "prefers-color-scheme",
|
|
2187
2186
|
motion: "prefers-reduced-motion",
|
|
@@ -2235,24 +2234,8 @@ function splitQueryList(text2) {
|
|
|
2235
2234
|
parts.push(text2.slice(start));
|
|
2236
2235
|
return parts.map((part2) => part2.trim()).filter((part2) => part2.length > 0);
|
|
2237
2236
|
}
|
|
2238
|
-
function collapse(query, found, matched, rewritten) {
|
|
2239
|
-
if (!found)
|
|
2240
|
-
return query;
|
|
2241
|
-
const negated = /^not\s/i.test(query);
|
|
2242
|
-
if (negated ? matched : !matched)
|
|
2243
|
-
return FALSE_QUERY;
|
|
2244
|
-
return negated ? TRUE_QUERY : rewritten;
|
|
2245
|
-
}
|
|
2246
2237
|
function rewriteQuery(query, feature, value) {
|
|
2247
|
-
|
|
2248
|
-
let matched = true;
|
|
2249
|
-
const rewritten = query.replace(featurePattern(feature), (_whole, queryValue) => {
|
|
2250
|
-
found = true;
|
|
2251
|
-
if (!featureMatches(queryValue, value))
|
|
2252
|
-
matched = false;
|
|
2253
|
-
return TRUE_TOKEN;
|
|
2254
|
-
});
|
|
2255
|
-
return collapse(query, found, matched, rewritten);
|
|
2238
|
+
return query.replace(featurePattern(feature), (_whole, queryValue) => featureMatches(queryValue, value) ? TRUE_TOKEN : FALSE_TOKEN);
|
|
2256
2239
|
}
|
|
2257
2240
|
function rewriteMediaText(text2, feature, value) {
|
|
2258
2241
|
if (value === "system")
|
|
@@ -2726,4 +2709,4 @@ function removeStyle(name, doc = document) {
|
|
|
2726
2709
|
findStyle(name, doc)?.remove();
|
|
2727
2710
|
}
|
|
2728
2711
|
|
|
2729
|
-
export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, setSystemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, authoredQuery, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };
|
|
2712
|
+
export { CLOCK_SPEED_MIN, CLOCK_SPEED_MAX, CLOCK_PRESETS, NativeDate, realNow, setClock, clockOn, now, wrapDate, NOW_READERS, temporalNow, readNow, takeOver, RINGS, SIDES, pxOf, boxModel, contentSize, hasBox, ringQuads, oneQuad, isPlain, alignQuads, ringPaths, luminance, parseColor, isCustomColor, toHex, parseHex, readColor, inkOn, POSTURES, openOf, DEVICES, deviceOf, formOf, formId, screenOf, hasTouch, turn, versionOf, newer, stamped, FRESH_ATTRIBUTE, fresh, webStorage, loads, carried, ownReload, GEO_PRESETS, resolveGeo, apply, reset, ZOOM_PRESETS, ZOOM_MIN, ZOOM_MAX, percent, stepZoom, wheelZoom, anchorScroll, DEFAULT_PINNED, DEFAULT_STATE, SCHEMES, MOTIONS, CONTRASTS, TRANSPARENCIES, DIRS, GEO_ERRORS, CLOCK_MODES, ONLINES, CONNECTIONS, SAVE_DATAS, BARS, BROWSERS, ORIENTATIONS, EDGES, SIDES2 as SIDES1, DEV_ICONS, VISIONS, GRAB_COLORS, resetState, merge, load, save, keepPlace, FRAME_ATTRIBUTE, FRAME_NAME, SIZE_MIN, SIZE_MAX, DPR_MIN, DPR_MAX, isDevknobsFrame, nativeScheme, handsSchemeDown, UNFRAMED, EXITED, knobFrame, needsFrame, plainFrame, frameForced, framed, readMessage, leaveFor, post, systemMedia, setSystemMedia, watchSystemMedia, baseMatchMedia, still, ownInline, TEXT_MIN, TEXT_MAX, apply2 as apply1, reset2 as reset1, rewriteMediaText, mentionsFeature, authoredQuery, walkRules, coarse, apply3 as apply2, destroy, isDocument, styleNode, isOwnSheet, addStyle, switchedSheet, ensureStyle, removeStyle };
|
|
@@ -22,11 +22,11 @@ import {
|
|
|
22
22
|
resume,
|
|
23
23
|
screenSizeOf,
|
|
24
24
|
uaPreset
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-s6yzsvs4.js";
|
|
26
26
|
import {
|
|
27
27
|
composedParent,
|
|
28
28
|
isDevknobs
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-whehz74d.js";
|
|
30
30
|
import {
|
|
31
31
|
DEFAULT_STATE,
|
|
32
32
|
EXITED,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
temporalNow,
|
|
69
69
|
webStorage,
|
|
70
70
|
wrapDate
|
|
71
|
-
} from "./index-
|
|
71
|
+
} from "./index-jfv7vavj.js";
|
|
72
72
|
import {
|
|
73
73
|
QUIET,
|
|
74
74
|
SHARED_VERSION,
|
|
@@ -1132,7 +1132,7 @@ function holdInTopLayer(host, rank) {
|
|
|
1132
1132
|
|
|
1133
1133
|
// src/engine/frames.ts
|
|
1134
1134
|
var kit = null;
|
|
1135
|
-
var load2 = () => import("./framekit-
|
|
1135
|
+
var load2 = () => import("./framekit-q97zeg1d.js");
|
|
1136
1136
|
var loading = null;
|
|
1137
1137
|
var down = false;
|
|
1138
1138
|
var waiting = [];
|