@vinena/knobs 0.6.4 → 0.6.6

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.
Files changed (53) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/{context-amfyasb5.js → context-eawqn680.js} +1 -1
  3. package/dist/{context-svtr7vwt.js → context-vd2xep5t.js} +1 -1
  4. package/dist/early.global.js +5 -5
  5. package/dist/{elementsview-05qybwpn.js → elementsview-dpm0xmb2.js} +12 -12
  6. package/dist/{elementsview-gjaqje2k.js → elementsview-n26sp8m7.js} +12 -12
  7. package/dist/engine/media.d.ts +3 -2
  8. package/dist/engine/pageshot.d.ts +25 -0
  9. package/dist/engine/shotmedia.d.ts +50 -0
  10. package/dist/{framekit-3bmkm34m.js → framekit-0as9t6a7.js} +194 -32
  11. package/dist/{framekit-h0jrc5gs.js → framekit-dknq662p.js} +194 -32
  12. package/dist/grab/fiber.d.ts +2 -0
  13. package/dist/grab/overlay.d.ts +10 -1
  14. package/dist/{index-fp1h37b3.js → index-20bc9yrj.js} +1 -1
  15. package/dist/{index-0yn3rnza.js → index-69fvtkcm.js} +6 -6
  16. package/dist/{index-h93t2tc5.js → index-7vb2ct4s.js} +6 -6
  17. package/dist/{index-0mav2k60.js → index-7w0nm76e.js} +10 -10
  18. package/dist/{index-zd6adby9.js → index-a8ffw5ft.js} +1 -1
  19. package/dist/{index-gm51cthv.js → index-ajs4na3f.js} +1 -1
  20. package/dist/{index-4192t60e.js → index-df35z48z.js} +2 -2
  21. package/dist/{index-6xsvcjnc.js → index-dxga6h10.js} +4 -4
  22. package/dist/{index-dzm8ywq0.js → index-jfv7vavj.js} +3 -20
  23. package/dist/{index-509g0pa8.js → index-r1rdj05c.js} +5 -5
  24. package/dist/{index-7cb4x1vj.js → index-s6yzsvs4.js} +1 -1
  25. package/dist/{index-aj1z83rt.js → index-t4wrs2a3.js} +10 -10
  26. package/dist/{index-rdssc7sz.js → index-whehz74d.js} +1 -1
  27. package/dist/{index-kpsrkzmf.js → index-x3sxssbs.js} +4 -4
  28. package/dist/{index-1mstjadm.js → index-xs29b55n.js} +4 -1
  29. package/dist/{index-xh39jtkq.js → index-ymqm185m.js} +1 -1
  30. package/dist/{index-ftjdt358.js → index-za4ppxay.js} +1 -1
  31. package/dist/index.global.js +125 -119
  32. package/dist/index.js +15 -15
  33. package/dist/{react-wqn4sx0n.js → react-0r5418av.js} +3 -20
  34. package/dist/{react-gkzn5n3v.js → react-10r2rczp.js} +5 -5
  35. package/dist/{react-r3zf2djn.js → react-2b7725je.js} +4 -4
  36. package/dist/{react-ethftdxp.js → react-4phtr2nd.js} +1 -1
  37. package/dist/{react-pvmjybgw.js → react-5ekfj7g3.js} +2 -2
  38. package/dist/{react-ttj8f9qp.js → react-5h7pxnax.js} +1 -1
  39. package/dist/{react-6fnxxs30.js → react-73reavv4.js} +1 -1
  40. package/dist/{react-2381cr3w.js → react-a1r0nr0g.js} +4 -4
  41. package/dist/{react-me102s1a.js → react-k4pkm1p5.js} +1 -1
  42. package/dist/{react-anqpcaqm.js → react-msn10fjb.js} +6 -6
  43. package/dist/{react-x1ndxf29.js → react-v08ywmtw.js} +6 -6
  44. package/dist/{react-4ykd817s.js → react-vbk58f9m.js} +1 -1
  45. package/dist/{react-4rbjw9af.js → react-wtgvkf6g.js} +1 -1
  46. package/dist/{react-ptamex0p.js → react-y9gr8yt2.js} +1 -1
  47. package/dist/{react-3mfz1x2a.js → react-yx3g9k55.js} +4 -1
  48. package/dist/react.js +15 -15
  49. package/dist/{replay-39ssrcqp.js → replay-461gcdh1.js} +7 -7
  50. package/dist/{replay-xacjqqt5.js → replay-ehgxp9py.js} +7 -7
  51. package/dist/{storageview-3gnncmmv.js → storageview-5p1y11b5.js} +6 -6
  52. package/dist/{storageview-dwsnvz36.js → storageview-kxzpnfvr.js} +6 -6
  53. package/package.json +1 -1
@@ -0,0 +1,50 @@
1
+ import { type MediaFeature } from "./media";
2
+ /**
3
+ * What `view` reads for each feature. One it reads no value of, as the
4
+ * browser does not know it, or more than one of, as a device with a mouse
5
+ * and a touch screen has two `any-pointer`s, is left out.
6
+ */
7
+ export declare function frameMedia(view: Window): [MediaFeature, string][];
8
+ /**
9
+ * Is `text` a namespace rule with a prefix? Only those move to the top of
10
+ * the copy's one sheet: a default one, with no prefix, would hold for every
11
+ * sheet of the page there, not only its own, and an html element would stop
12
+ * matching a plain type selector. A default one is left out of the copy.
13
+ */
14
+ export declare function prefixedNamespace(text: string): boolean;
15
+ /** Does a `color-scheme` let the browser pick light or dark, by the system's? */
16
+ export declare function eitherScheme(value: string): boolean;
17
+ /** The copy's rules, made to read what the frame reads. */
18
+ export interface Frozen {
19
+ rules: string[];
20
+ /**
21
+ * A rule sets a scheme the rules alone do not tell, through a variable, or
22
+ * one that could not be parsed, so each element that picks light or dark
23
+ * by its computed scheme is pinned in the copy itself.
24
+ */
25
+ computed: boolean;
26
+ }
27
+ /**
28
+ * The copy's rules, one by one, made to read `read`: each media query, and
29
+ * each `color-scheme` that lets the browser pick light or dark set to the
30
+ * frame's scheme, its priority kept. A rule that has either is parsed in a
31
+ * sheet of its own, made by `Sheet`, rewritten, and written out again; the
32
+ * rest stay as they are, so nothing else is lost. Each rule stands alone,
33
+ * so their order, and the order of their layers, stays the page's. The
34
+ * page's prefixed `@namespace` rules go in front of each, so a namespaced selector
35
+ * parses, and are left out of what is written. Without a way to parse them,
36
+ * the rules stay as they are.
37
+ */
38
+ export declare function freezeMedia(rules: string[], read: [MediaFeature, string][], Sheet: typeof CSSStyleSheet | undefined): Frozen;
39
+ /**
40
+ * What to pin each element of the page in `doc` to in its copy, where it
41
+ * lets the browser pick light or dark, or null to leave it: the root, whose
42
+ * scheme comes from its `color-scheme` meta too where its own is `normal`,
43
+ * and each with a scheme in its inline style, which no rule rewritten
44
+ * reaches. Every element, where `computed` says the rules leave some
45
+ * unknown. Null where none would be pinned, so most pages cost one look at
46
+ * the root.
47
+ */
48
+ export declare function schemePins(doc: Document, view: Window, scheme: string, computed: boolean): ((node: Element) => string | null) | null;
49
+ /** Pin `node` of a copy to `scheme`, over whatever the copy's rules say. */
50
+ export declare function pinScheme(node: Element, scheme: string): void;
@@ -24,7 +24,7 @@ import {
24
24
  turnOf,
25
25
  turnedPose,
26
26
  windowRect
27
- } from "./index-gm51cthv.js";
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-7cb4x1vj.js";
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-dzm8ywq0.js";
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
- for (const rule of sheet.cssRules)
4888
- rules.push(written2(rule));
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
- if (leave) {
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
- if (node && leave(node))
4899
- copied[index]?.setAttribute("data-devknobs", "");
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;
@@ -4917,6 +5057,24 @@ function rootSize(doc, view) {
4917
5057
  const size = view.getComputedStyle(doc.documentElement).fontSize;
4918
5058
  return size ? `font-size:${size} !important` : "";
4919
5059
  }
5060
+ function layoutZoom(view) {
5061
+ if (!("userAgentData" in navigator))
5062
+ return 1;
5063
+ const ratio = view.devicePixelRatio;
5064
+ return Number.isFinite(ratio) && ratio > 0 ? ratio : 1;
5065
+ }
5066
+ function ownZoom(doc, view) {
5067
+ const own = Number(view.getComputedStyle(doc.documentElement).zoom);
5068
+ return Number.isFinite(own) && own > 0 ? own : 1;
5069
+ }
5070
+ function rootZoom(doc, view, ratio) {
5071
+ const own = ownZoom(doc, view);
5072
+ return ratio === 1 && own === 1 ? "" : `;zoom:${ratio * own} !important`;
5073
+ }
5074
+ function drawing(markup, width, height, sized, zoom) {
5075
+ const view = Number.isFinite(zoom) && zoom > 0 && zoom !== 1 ? ` viewBox="0 0 ${width * zoom} ${height * zoom}"` : "";
5076
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}"${view} style="${sized}">` + `<foreignObject width="100%" height="100%">${markup}</foreignObject></svg>`;
5077
+ }
4920
5078
  async function paintPage(frame2, glass, size, color, copy) {
4921
5079
  const doc = frame2.contentDocument;
4922
5080
  const view = frame2.contentWindow;
@@ -4944,11 +5102,14 @@ async function paintPage(frame2, glass, size, color, copy) {
4944
5102
  } catch {}
4945
5103
  }
4946
5104
  const root = copy.cloneNode(true);
4947
- const scrolled = `position:relative;left:${-scrollX}px;top:${-scrollY}px`;
5105
+ const own = ownZoom(doc, view);
5106
+ const scrolled = `position:relative;left:${-scrollX / own}px;top:${-scrollY / own}px`;
4948
5107
  const sized = rootSize(doc, view);
4949
- root.setAttribute("style", `${root.getAttribute("style") ?? ""};${sized};${scrolled}`);
5108
+ const zoom = layoutZoom(view);
5109
+ const zoomed = rootZoom(doc, view, zoom);
5110
+ root.setAttribute("style", `${root.getAttribute("style") ?? ""};${sized};${scrolled}${zoomed}`);
4950
5111
  const markup = new XMLSerializer().serializeToString(root);
4951
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${height}" style="${sized}">` + `<foreignObject width="100%" height="100%">${markup}</foreignObject></svg>`;
5112
+ const svg = drawing(markup, width, height, sized, zoom);
4952
5113
  const image = new Image;
4953
5114
  try {
4954
5115
  image.src = svgUrl(svg);
@@ -5028,12 +5189,13 @@ function pictureOf(frame2) {
5028
5189
  node.setAttribute("style", viewportUnits(node.getAttribute("style") ?? "", tall));
5029
5190
  }
5030
5191
  const full = Math.max(doc.documentElement.scrollHeight, tall);
5031
- const root = doc.documentElement.getBoundingClientRect().height;
5192
+ const root = doc.documentElement.getBoundingClientRect().height / ownZoom(doc, view);
5032
5193
  const sized = rootSize(doc, view);
5033
- copy.setAttribute("style", `${copy.getAttribute("style") ?? ""};${sized};height:${root}px !important`);
5194
+ const zoom = layoutZoom(view);
5195
+ const zoomed = rootZoom(doc, view, zoom);
5196
+ copy.setAttribute("style", `${copy.getAttribute("style") ?? ""};${sized};height:${root}px !important${zoomed}`);
5034
5197
  const markup = new XMLSerializer().serializeToString(copy);
5035
- const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${width}" height="${full}" style="${sized}">` + `<foreignObject width="100%" height="100%">${markup}</foreignObject></svg>`;
5036
- return { src: svgUrl(svg), width, height: full };
5198
+ return { src: svgUrl(drawing(markup, width, full, sized, zoom)), width, height: full };
5037
5199
  }
5038
5200
  function createUnderbar(glass, frame2) {
5039
5201
  const band = el("div", "underbar");
@@ -6401,8 +6563,8 @@ function copyBars(shown2, value, size) {
6401
6563
  const svg = `<svg xmlns="http://www.w3.org/2000/svg" width="${size.width}" height="${size.height}">` + `<foreignObject width="100%" height="100%">${markup}</foreignObject></svg>`;
6402
6564
  const image = new Image;
6403
6565
  image.src = svgUrl(svg);
6404
- const drawing = image.decode().then(() => image, () => null);
6405
- return { drawing, size, glass: bars ? glassOf(bars, host) : [] };
6566
+ const drawing2 = image.decode().then(() => image, () => null);
6567
+ return { drawing: drawing2, size, glass: bars ? glassOf(bars, host) : [] };
6406
6568
  }
6407
6569
  async function paintBars(shot, bars) {
6408
6570
  const image = await bars.drawing;
@@ -7064,10 +7226,10 @@ function leafOf(side, picture, turning2, across) {
7064
7226
  screen.style.boxShadow = `0 0 0 ${UNDER}px #000`;
7065
7227
  node.append(screen);
7066
7228
  if (body) {
7067
- const drawing = drawMock(body, size, href);
7068
- drawing.style.width = "100%";
7069
- drawing.style.height = "100%";
7070
- node.append(drawing);
7229
+ const drawing2 = drawMock(body, size, href);
7230
+ drawing2.style.width = "100%";
7231
+ drawing2.style.height = "100%";
7232
+ node.append(drawing2);
7071
7233
  }
7072
7234
  const opening = placeAt(div(""), rect);
7073
7235
  const dark = div("");
@@ -8660,7 +8822,7 @@ var veil = null;
8660
8822
  var mat = null;
8661
8823
  var matKey = "";
8662
8824
  var stage = null;
8663
- var drawing = null;
8825
+ var drawing2 = null;
8664
8826
  var screen = null;
8665
8827
  var glass = null;
8666
8828
  var pageBox = null;
@@ -9144,7 +9306,7 @@ function unwatchDensity() {
9144
9306
  densityRatio = 0;
9145
9307
  }
9146
9308
  function resize() {
9147
- if (!frame3 || !letterbox || !stage || !drawing || !screen || !readout || !caption)
9309
+ if (!frame3 || !letterbox || !stage || !drawing2 || !screen || !readout || !caption)
9148
9310
  return;
9149
9311
  if (released || turning() || folding())
9150
9312
  return;
@@ -9179,9 +9341,9 @@ function resize() {
9179
9341
  const radii = mock ? corners(mock.screenRadius).map((radius) => `${radius * place2.zoom}px`) : [];
9180
9342
  showBrowser(bars, page, place2, auto, radii.join(" "));
9181
9343
  touchDot?.fit(place2, place2.zoom);
9182
- drawing.style.width = `${place2.box.width}px`;
9183
- drawing.style.height = `${place2.box.height}px`;
9184
- const at = mock ? drawing.getBoundingClientRect() : null;
9344
+ drawing2.style.width = `${place2.box.width}px`;
9345
+ drawing2.style.height = `${place2.box.height}px`;
9346
+ const at = mock ? drawing2.getBoundingClientRect() : null;
9185
9347
  const ratio = window.devicePixelRatio;
9186
9348
  const nudge = at ? { x: snapShift(at.left + place2.left, ratio), y: snapShift(at.top + place2.top, ratio) } : null;
9187
9349
  screen.style.left = `${place2.left - (mock?.inset.left ?? 0) * place2.scale + (nudge?.x ?? 0)}px`;
@@ -9507,8 +9669,8 @@ function open(veiled, first) {
9507
9669
  readout.append(caption, picker);
9508
9670
  stage = document.createElement("div");
9509
9671
  stage.className = "stage";
9510
- drawing = document.createElement("div");
9511
- drawing.className = "drawing";
9672
+ drawing2 = document.createElement("div");
9673
+ drawing2.className = "drawing";
9512
9674
  screen = document.createElement("div");
9513
9675
  screen.className = "screen";
9514
9676
  glass = document.createElement("div");
@@ -9571,8 +9733,8 @@ function open(veiled, first) {
9571
9733
  turnCover.className = "screenblank";
9572
9734
  turnCover.hidden = true;
9573
9735
  screen.append(glass);
9574
- drawing.append(screen);
9575
- stage.append(drawing);
9736
+ drawing2.append(screen);
9737
+ stage.append(drawing2);
9576
9738
  letterbox.append(veil, back, readout, stage, notice);
9577
9739
  letterbox.addEventListener("wheel", onWheel, { passive: false });
9578
9740
  root.append(letterbox);
@@ -9637,7 +9799,7 @@ function teardown() {
9637
9799
  mat = null;
9638
9800
  matKey = "";
9639
9801
  stage = null;
9640
- drawing = null;
9802
+ drawing2 = null;
9641
9803
  screen = null;
9642
9804
  glass = null;
9643
9805
  pageBox = null;