The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 17:00 UTC
fix(web): theme editor returns to its spot after the window shrinks and grows back (#25076)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 25, 2026 at 18:21 UTC
4e43779f82d4eff16d37932a776df743fb37d3d7
6 files changed
+244
-98
apps/web/src/components/settings/FontFamilyPicker.tsx
+1
-1
@@ -34,6 +34,7 @@ let enumerationState: FontEnumerationState = supportsFontEnumeration()
34
const enumerationListeners = new Set<() => void>();
35
36
function subscribeToEnumeration(listener: () => void): () => void {
37
+ probeAlreadyGrantedPermission();
38
enumerationListeners.add(listener);
39
return () => enumerationListeners.delete(listener);
40
}
@@ -74,7 +75,6 @@ function probeAlreadyGrantedPermission(): void {
75
}
76
77
export function useFontEnumeration(): FontEnumerationState {
77
- useEffect(probeAlreadyGrantedPermission, []);
78
return useSyncExternalStore(subscribeToEnumeration, readEnumerationState);
79
}
80
apps/web/src/components/settings/SettingsPanels.tsx
+7
-12
@@ -3,7 +3,7 @@ import { NotificationSettings } from "./NotificationSettings";
3
import { PRIVACY_POLICY_URL } from "../../legalLinks";
4
import { CheckIcon, ChevronRightIcon } from "lucide-react";
5
import { Link, useNavigate } from "@tanstack/react-router";
6
-import { useEffect, useRef, useState } from "react";
6
+import { useRef, useState } from "react";
7
import {
8
type DesktopUpdateChannel,
9
IDLE_COMPACTION_MODES,
@@ -716,17 +716,12 @@ function LegacyFeaturesSection() {
716
const [open, setOpen] = useState(false);
717
const searchTargetId = useSettingsSearchTargetId();
718
const targetRef = useSettingsSearchTarget<HTMLElement>("legacy-features");
719
- const lastExpandedTargetRef = useRef<string | null>(null);
720
- useEffect(() => {
721
- if (searchTargetId === null) {
722
- lastExpandedTargetRef.current = null;
723
- return;
724
- }
725
- if (!LEGACY_FEATURE_TARGET_IDS.has(searchTargetId)) return;
726
- if (lastExpandedTargetRef.current === searchTargetId) return;
727
- lastExpandedTargetRef.current = searchTargetId;
728
- setOpen(true);
729
- }, [searchTargetId]);
719
+ // A search jump to a legacy setting opens the fold before its row mounts.
720
+ const [seenSearchTargetId, setSeenSearchTargetId] = useState<string | null>(null);
721
+ if (seenSearchTargetId !== searchTargetId) {
722
+ setSeenSearchTargetId(searchTargetId);
723
+ if (searchTargetId !== null && LEGACY_FEATURE_TARGET_IDS.has(searchTargetId)) setOpen(true);
724
+ }
725
726
return (
727
<section id="legacy-features" ref={targetRef} tabIndex={-1} className="space-y-2.5">
apps/web/src/components/settings/ThemeColorPicker.tsx
+51
-35
@@ -1,5 +1,4 @@
1
-import { memo, useEffect, useEffectEvent, useRef, useState } from "react";
2
-import { useStableCallback } from "../../hooks/useStableCallback";
1
+import { memo, useEffect, useState } from "react";
2
import { isThemeColor, themeColorToHex, type ThemeColorRole } from "../../themePalette";
3
import { cn } from "../../lib/utils";
4
import { hexToHsv, hsvToHex, type HsvColor } from "../../lib/color";
@@ -67,13 +66,46 @@ function themeRgbValue(hex: string) {
66
return themeHexToRgb(hex).join(", ");
67
}
68
69
+// Local state updates immediately for a smooth thumb; the parent commit
70
+// (which can regenerate a whole guided palette) is batched to one call per
71
+// animation frame. The popover flushes it on close, the drag surfaces on
72
+// release, and the picker on unmount, so the final frame is never lost.
73
+function createFrameCommitter() {
74
+ let pending: { readonly color: string; readonly commit: (color: string) => void } | null = null;
75
+ let frame: number | null = null;
76
+ const flush = () => {
77
+ if (frame !== null) {
78
+ cancelAnimationFrame(frame);
79
+ frame = null;
80
+ }
81
+ const next = pending;
82
+ pending = null;
83
+ next?.commit(next.color);
84
+ };
85
+ return {
86
+ schedule(color: string, commit: (color: string) => void) {
87
+ pending = { color, commit };
88
+ if (frame !== null) return;
89
+ frame = requestAnimationFrame(() => {
90
+ frame = null;
91
+ flush();
92
+ });
93
+ },
94
+ flush,
95
+ };
96
+}
97
+
98
+type FrameCommitter = ReturnType<typeof createFrameCommitter>;
99
+
100
function ThemeColorPickerPanel({
101
label,
102
value,
103
+ committer,
104
onChange,
105
}: {
106
label: string;
107
value: string;
108
+ committer: FrameCommitter;
109
onChange: (value: string) => void;
110
}) {
111
const normalizedValue = normalizeThemePickerColor(value);
@@ -98,40 +130,12 @@ function ThemeColorPickerPanel({
130
if (currentColor !== normalizedValue) setHsv(hexToHsv(normalizedValue));
131
}
132
101
- // Update the thumb immediately; batch expensive parent palette regeneration to one commit per frame.
102
- const commitColor = useStableCallback(onChange);
103
- const pendingCommitRef = useRef<string | null>(null);
104
- const commitFrameRef = useRef<number | null>(null);
105
- // Flush the last drag frame if the popover closes or the pointer lifts before animation frame.
106
- const flushPendingCommit = () => {
107
- if (commitFrameRef.current !== null) {
108
- cancelAnimationFrame(commitFrameRef.current);
109
- commitFrameRef.current = null;
110
- }
111
- const pending = pendingCommitRef.current;
112
- pendingCommitRef.current = null;
113
- if (pending !== null) commitColor(pending);
114
- };
115
- // Flush only on unmount; rerunning this cleanup mid-drag would commit early.
116
- const flushOnUnmount = useEffectEvent(() => flushPendingCommit());
117
- useEffect(() => () => flushOnUnmount(), []);
118
- const scheduleCommit = (color: string) => {
119
- pendingCommitRef.current = color;
120
- if (commitFrameRef.current !== null) return;
121
- commitFrameRef.current = requestAnimationFrame(() => {
122
- commitFrameRef.current = null;
123
- const pending = pendingCommitRef.current;
124
- pendingCommitRef.current = null;
125
- if (pending !== null) commitColor(pending);
126
- });
127
- };
128
-
133
const commitHsv = (nextHsv: HsvColor) => {
134
setHsv(nextHsv);
135
const nextColor = hsvToHex(nextHsv.h, nextHsv.s, nextHsv.v);
136
setHexDraft(nextColor);
137
setRgbDraft(themeRgbValue(nextColor));
134
- scheduleCommit(nextColor + alphaSuffix);
138
+ committer.schedule(nextColor + alphaSuffix, onChange);
139
};
140
141
const handleHexChange = (nextValue: string) => {
@@ -169,13 +173,13 @@ function ThemeColorPickerPanel({
173
label={label}
174
value={hsv}
175
onChange={commitHsv}
172
- onInteractionEnd={flushPendingCommit}
176
+ onInteractionEnd={committer.flush}
177
/>
178
<ColorHueSlider
179
label={`${label} hue`}
180
value={hsv.h}
181
onChange={(h) => commitHsv({ ...hsv, h })}
178
- onInteractionEnd={flushPendingCommit}
182
+ onInteractionEnd={committer.flush}
183
/>
184
<div className="grid grid-cols-[1fr_1.2fr] gap-2">
185
<label className="grid min-w-0 gap-1">
@@ -243,8 +247,15 @@ function ThemeColorPicker({
247
onChange: (value: string) => void;
248
onInteract?: () => void;
249
}) {
250
+ const [committer] = useState(createFrameCommitter);
251
+ // Unmounting with the popover open (the editor closes mid-drag) never fires onOpenChange.
252
+ useEffect(() => committer.flush, [committer]);
253
return (
247
- <Popover>
254
+ <Popover
255
+ onOpenChange={(open) => {
256
+ if (!open) committer.flush();
257
+ }}
258
+ >
259
<Tooltip>
260
<TooltipTrigger
261
render={
@@ -275,7 +286,12 @@ function ThemeColorPicker({
286
side="bottom"
287
sideOffset={10}
288
>
278
- <ThemeColorPickerPanel label={label} onChange={onChange} value={value} />
289
+ <ThemeColorPickerPanel
290
+ committer={committer}
291
+ label={label}
292
+ onChange={onChange}
293
+ value={value}
294
+ />
295
</PopoverPopup>
296
</Popover>
297
);
apps/web/src/components/settings/ThemeEditorPanel.browser.test.tsx
new
+113
@@ -0,0 +1,113 @@
1
+import { describe, expect, it, vi } from "vite-plus/test";
2
+import { page } from "vite-plus/test/browser";
3
+
4
+import { render } from "../../../test/render";
5
+import { ThemeEditorPanel } from "./ThemeEditorPanel";
6
+
7
+function dragHeader(panel: HTMLElement, toX: number, toY: number) {
8
+ const header = panel.querySelector<HTMLElement>("h2")!.closest<HTMLElement>(".cursor-grab")!;
9
+ const rect = panel.getBoundingClientRect();
10
+ const start = { clientX: rect.left + 40, clientY: rect.top + 10 };
11
+ const init = { bubbles: true, button: 0, pointerId: 1 };
12
+ header.dispatchEvent(new PointerEvent("pointerdown", { ...init, ...start }));
13
+ header.dispatchEvent(
14
+ new PointerEvent("pointermove", { ...init, clientX: toX + 40, clientY: toY + 10 }),
15
+ );
16
+ header.dispatchEvent(new PointerEvent("pointerup", init));
17
+}
18
+
19
+function dragResizeHandle(panel: HTMLElement, byX: number) {
20
+ const handle = panel.querySelector<HTMLElement>(".cursor-se-resize")!;
21
+ const rect = handle.getBoundingClientRect();
22
+ const init = { bubbles: true, button: 0, pointerId: 2 };
23
+ const start = { clientX: rect.left + 4, clientY: rect.top + 4 };
24
+ handle.dispatchEvent(new PointerEvent("pointerdown", { ...init, ...start }));
25
+ handle.dispatchEvent(
26
+ new PointerEvent("pointermove", {
27
+ ...init,
28
+ clientX: start.clientX + byX,
29
+ clientY: start.clientY,
30
+ }),
31
+ );
32
+ handle.dispatchEvent(new PointerEvent("pointerup", init));
33
+}
34
+
35
+async function renderPanel() {
36
+ await page.viewport(1280, 900);
37
+ const stack = new AsyncDisposableStack();
38
+ // Synthetic pointer ids are not active pointers, so the browser would reject capture.
39
+ stack.use(vi.spyOn(HTMLElement.prototype, "setPointerCapture").mockImplementation(() => {}));
40
+ // Tailwind is not loaded here; give the panel its fixed, card-sized box.
41
+ const style = document.head.appendChild(document.createElement("style"));
42
+ style.textContent = "[data-theme-editor-panel]{position:fixed;width:400px;height:300px}";
43
+ stack.defer(() => style.remove());
44
+ const screen = stack.use(
45
+ await render(
46
+ <ThemeEditorPanel
47
+ open
48
+ onOpenChange={() => {}}
49
+ onSaved={() => true}
50
+ editingTheme={null}
51
+ initialAppearance="dark"
52
+ restoreTheme={() => {}}
53
+ />,
54
+ ),
55
+ );
56
+ const panel = screen.getByRole("dialog", { name: "Create theme" });
57
+ await expect.element(panel).toBeVisible();
58
+ return {
59
+ panel: panel.element() as HTMLElement,
60
+ [Symbol.asyncDispose]: () => stack.disposeAsync(),
61
+ };
62
+}
63
+
64
+describe("ThemeEditorPanel", () => {
65
+ it("keeps its left edge when resized after the window shrank", async () => {
66
+ await using view = await renderPanel();
67
+ dragHeader(view.panel, 700, 40);
68
+ await expect.poll(() => view.panel.style.left).toBe("700px");
69
+
70
+ await page.viewport(600, 900);
71
+ await expect.poll(() => Number.parseFloat(view.panel.style.left)).toBeLessThan(600);
72
+ const clampedLeft = view.panel.style.left;
73
+
74
+ dragResizeHandle(view.panel, -100);
75
+ await expect.poll(() => view.panel.style.width).not.toBe("");
76
+ expect(view.panel.style.left).toBe(clampedLeft);
77
+ });
78
+
79
+ it("returns to where the user left it when the window shrinks and grows back", async () => {
80
+ await page.viewport(1280, 900);
81
+ // Synthetic pointer ids are not active pointers, so the browser would reject capture.
82
+ using _capture = vi
83
+ .spyOn(HTMLElement.prototype, "setPointerCapture")
84
+ .mockImplementation(() => {});
85
+ // Tailwind is not loaded here; give the panel its fixed, card-sized box.
86
+ const style = document.head.appendChild(document.createElement("style"));
87
+ style.textContent = "[data-theme-editor-panel]{position:fixed;width:400px;height:300px}";
88
+ using _style = { [Symbol.dispose]: () => style.remove() };
89
+ await using screen = await render(
90
+ <ThemeEditorPanel
91
+ open
92
+ onOpenChange={() => {}}
93
+ onSaved={() => true}
94
+ editingTheme={null}
95
+ initialAppearance="dark"
96
+ restoreTheme={() => {}}
97
+ />,
98
+ );
99
+ const panel = screen.getByRole("dialog", { name: "Create theme" });
100
+ await expect.element(panel).toBeVisible();
101
+
102
+ dragHeader(panel.element() as HTMLElement, 700, 40);
103
+ await expect.poll(() => (panel.element() as HTMLElement).style.left).toBe("700px");
104
+
105
+ await page.viewport(600, 900);
106
+ await expect
107
+ .poll(() => Number.parseFloat((panel.element() as HTMLElement).style.left))
108
+ .toBeLessThan(600);
109
+
110
+ await page.viewport(1280, 900);
111
+ await expect.poll(() => (panel.element() as HTMLElement).style.left).toBe("700px");
112
+ });
113
+});
apps/web/src/components/settings/ThemeEditorPanel.tsx
+57
-50
@@ -22,6 +22,7 @@ import {
22
type ThemeColorRole,
23
type ThemeDefinition,
24
} from "../../themePalette";
25
+import { useViewportSize } from "../../hooks/useViewportSize";
26
import { cn } from "../../lib/utils";
27
import { Button } from "../ui/button";
28
import { MorphIcon } from "~/components/MorphIcon";
@@ -271,21 +272,28 @@ function getManagedEditorColors(
272
);
273
}
274
275
+const PANEL_MARGIN = 8;
276
+const PANEL_MIN_WIDTH = 280;
277
+const PANEL_MIN_HEIGHT = 220;
278
+
279
+/** Keeps the panel horizontally inside the viewport. Vertically only its header must stay
280
+ * visible, so users can park the panel low to see the app behind it. */
281
function clampPanelPosition(
275
- panel: HTMLElement | null,
282
+ viewport: { readonly width: number; readonly height: number },
283
x: number,
284
y: number,
278
- widthOverride?: number,
285
+ width: number,
286
) {
280
- const margin = 8;
281
- // Use the caller's new width after shrink; DOM width stays stale until commit.
282
- const width = widthOverride ?? panel?.offsetWidth ?? 0;
287
+ const maxX = Math.max(PANEL_MARGIN, viewport.width - width - PANEL_MARGIN);
288
+ const maxY = Math.max(PANEL_MARGIN, viewport.height - 48);
289
return {
284
- x: Math.min(Math.max(x, margin), Math.max(margin, window.innerWidth - width - margin)),
285
- y: Math.min(Math.max(y, margin), Math.max(margin, window.innerHeight - 48)),
290
+ x: Math.min(Math.max(x, PANEL_MARGIN), maxX),
291
+ y: Math.min(Math.max(y, PANEL_MARGIN), maxY),
292
};
293
}
294
295
+const readWindowViewport = () => ({ width: window.innerWidth, height: window.innerHeight });
296
+
297
// Kept out of the component: the compiler cannot lower a throw inside try/catch.
298
function retireMergedTheme(retired: ThemeDefinition, mergeTarget: ThemeDefinition) {
299
try {
@@ -341,10 +349,12 @@ export function ThemeEditorPanel({
349
const [isInspecting, setIsInspecting] = useState(false);
350
const [selectedRole, setSelectedRole] = useState<ThemeColorRole | null>(null);
351
const [usageCount, setUsageCount] = useState<number | null>(null);
344
- const [position, setPosition] = useState<{ x: number; y: number } | null>(null);
352
+ // The rendered width is CSS-sized unless the user resized the panel, so the position
353
+ // remembers the width measured at the last drag or resize.
354
+ const [position, setPosition] = useState<{ x: number; y: number; width: number } | null>(null);
355
const [size, setSize] = useState<{ width: number; height: number } | null>(null);
356
const panelRef = useRef<HTMLDivElement>(null);
347
- const dragOffsetRef = useRef<{ dx: number; dy: number } | null>(null);
357
+ const dragOffsetRef = useRef<{ dx: number; dy: number; width: number } | null>(null);
358
const resizeStartRef = useRef<{
359
pointerX: number;
360
pointerY: number;
@@ -353,32 +363,6 @@ export function ThemeEditorPanel({
363
width: number;
364
height: number;
365
} | null>(null);
356
- useEffect(() => {
357
- if (!open) return;
358
- const clamp = () => {
359
- const margin = 8;
360
- let clampedWidth: number | undefined;
361
- let clampedHeight: number | undefined;
362
- setSize((current) => {
363
- if (!current) return current;
364
- clampedWidth = Math.max(280, Math.min(current.width, window.innerWidth - margin * 2));
365
- clampedHeight = Math.max(220, Math.min(current.height, window.innerHeight - margin * 2));
366
- return { width: clampedWidth, height: clampedHeight };
367
- });
368
- setPosition((current) => {
369
- if (!current) return current;
370
- const clamped = clampPanelPosition(panelRef.current, current.x, current.y, clampedWidth);
371
- const height = isMinimized
372
- ? (panelRef.current?.offsetHeight ?? 0)
373
- : (clampedHeight ?? panelRef.current?.offsetHeight ?? 0);
374
- const maxY = Math.max(margin, window.innerHeight - height - margin);
375
- return { x: clamped.x, y: Math.min(clamped.y, maxY) };
376
- });
377
- };
378
- window.addEventListener("resize", clamp);
379
- return () => window.removeEventListener("resize", clamp);
380
- }, [isMinimized, open]);
381
-
366
// Seed during render so the first open frame cannot preview the previous session's colors.
367
const [seededOpen, setSeededOpen] = useState(false);
368
if (seededOpen !== open) {
@@ -1010,20 +994,39 @@ export function ThemeEditorPanel({
994
);
995
};
996
1013
- const clampPosition = (x: number, y: number) => clampPanelPosition(panelRef.current, x, y);
997
+ // Geometry is stored as the user left it and fitted to the current viewport here, so a
998
+ // window that shrinks and grows back returns the panel to where it was.
999
+ const viewport = useViewportSize();
1000
+ const shownSize = size && {
1001
+ width: Math.max(PANEL_MIN_WIDTH, Math.min(size.width, viewport.width - PANEL_MARGIN * 2)),
1002
+ height: Math.max(PANEL_MIN_HEIGHT, Math.min(size.height, viewport.height - PANEL_MARGIN * 2)),
1003
+ };
1004
+ const shownPosition =
1005
+ position &&
1006
+ clampPanelPosition(viewport, position.x, position.y, shownSize?.width ?? position.width);
1007
1008
const handleDragPointerDown = (event: ReactPointerEvent<HTMLDivElement>) => {
1009
if ((event.target as HTMLElement).closest("button, input, a")) return;
1010
const rect = panelRef.current?.getBoundingClientRect();
1011
if (!rect) return;
1019
- dragOffsetRef.current = { dx: event.clientX - rect.x, dy: event.clientY - rect.y };
1012
+ dragOffsetRef.current = {
1013
+ dx: event.clientX - rect.x,
1014
+ dy: event.clientY - rect.y,
1015
+ width: rect.width,
1016
+ };
1017
event.currentTarget.setPointerCapture(event.pointerId);
1018
};
1019
1020
const handleDragPointerMove = (event: ReactPointerEvent<HTMLDivElement>) => {
1021
const offset = dragOffsetRef.current;
1022
if (!offset) return;
1026
- setPosition(clampPosition(event.clientX - offset.dx, event.clientY - offset.dy));
1023
+ const next = clampPanelPosition(
1024
+ readWindowViewport(),
1025
+ event.clientX - offset.dx,
1026
+ event.clientY - offset.dy,
1027
+ offset.width,
1028
+ );
1029
+ setPosition({ ...next, width: offset.width });
1030
};
1031
1032
const endDrag = () => {
@@ -1034,8 +1037,10 @@ export function ThemeEditorPanel({
1037
const rect = panelRef.current?.getBoundingClientRect();
1038
if (!rect) return;
1039
event.preventDefault();
1037
- // Convert bottom-right parking to explicit position before resizing so the top-left corner stays fixed.
1038
- if (position === null) setPosition(clampPosition(rect.x, rect.y));
1040
+ // Resize from where the panel is drawn, so a position clamped after the window shrank, or bottom-right
1041
+ // parking, can't make the top-left corner slide.
1042
+ const next = clampPanelPosition(readWindowViewport(), rect.x, rect.y, rect.width);
1043
+ setPosition({ ...next, width: rect.width });
1044
resizeStartRef.current = {
1045
pointerX: event.clientX,
1046
pointerY: event.clientY,
@@ -1050,15 +1055,15 @@ export function ThemeEditorPanel({
1055
const handleResizePointerMove = (event: ReactPointerEvent<HTMLDivElement>) => {
1056
const start = resizeStartRef.current;
1057
if (!start) return;
1053
- const margin = 8;
1054
- const MIN_WIDTH = 280;
1055
- const MIN_HEIGHT = 220;
1056
- const maxWidth = Math.max(MIN_WIDTH, window.innerWidth - margin - start.left);
1057
- const maxHeight = Math.max(MIN_HEIGHT, window.innerHeight - margin - start.top);
1058
+ const maxWidth = Math.max(PANEL_MIN_WIDTH, window.innerWidth - PANEL_MARGIN - start.left);
1059
+ const maxHeight = Math.max(PANEL_MIN_HEIGHT, window.innerHeight - PANEL_MARGIN - start.top);
1060
setSize({
1059
- width: Math.min(Math.max(start.width + event.clientX - start.pointerX, MIN_WIDTH), maxWidth),
1061
+ width: Math.min(
1062
+ Math.max(start.width + event.clientX - start.pointerX, PANEL_MIN_WIDTH),
1063
+ maxWidth,
1064
+ ),
1065
height: Math.min(
1061
- Math.max(start.height + event.clientY - start.pointerY, MIN_HEIGHT),
1066
+ Math.max(start.height + event.clientY - start.pointerY, PANEL_MIN_HEIGHT),
1067
maxHeight,
1068
),
1069
});
@@ -1080,9 +1085,11 @@ export function ThemeEditorPanel({
1085
ref={panelRef}
1086
role="dialog"
1087
style={{
1083
- ...(position ? { left: position.x, top: position.y } : {}),
1084
- ...(size ? { width: size.width } : {}),
1085
- ...(size && !isMinimized ? { height: size.height, maxHeight: "calc(100dvh - 1rem)" } : {}),
1088
+ ...(shownPosition ? { left: shownPosition.x, top: shownPosition.y } : {}),
1089
+ ...(shownSize ? { width: shownSize.width } : {}),
1090
+ ...(shownSize && !isMinimized
1091
+ ? { height: shownSize.height, maxHeight: "calc(100dvh - 1rem)" }
1092
+ : {}),
1093
}}
1094
>
1095
<div
apps/web/src/hooks/useViewportSize.ts
new
+15
@@ -0,0 +1,15 @@
1
+import { useSyncExternalStore } from "react";
2
+
3
+const subscribeToViewport = (onChange: () => void) => {
4
+ window.addEventListener("resize", onChange);
5
+ return () => window.removeEventListener("resize", onChange);
6
+};
7
+const readViewportWidth = () => window.innerWidth;
8
+const readViewportHeight = () => window.innerHeight;
9
+
10
+/** The window's CSS viewport, re-read on every resize. */
11
+export function useViewportSize() {
12
+ const width = useSyncExternalStore(subscribeToViewport, readViewportWidth);
13
+ const height = useSyncExternalStore(subscribeToViewport, readViewportHeight);
14
+ return { width, height };
15
+}