@superwall/studio 1.6.1 → 1.6.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/README.md +27 -10
- package/dist/assets/index-BMe9fPdZ.css +1 -0
- package/dist/assets/index-Czsb6jZs.js +11 -0
- package/dist/index.html +3 -3
- package/dist/lib/components/Dialog.d.ts +7 -0
- package/dist/lib/components/EmptyState.d.ts +9 -0
- package/dist/lib/components/InlineCode.d.ts +2 -0
- package/dist/lib/components/PaywallToasts.d.ts +8 -0
- package/dist/lib/components/SuperwallLogo.d.ts +9 -0
- package/dist/lib/components/Tooltip.d.ts +3 -1
- package/dist/lib/components/chrome/TopBar.d.ts +2 -3
- package/dist/lib/components/controls.d.ts +10 -1
- package/dist/lib/components/icons.d.ts +30 -17
- package/dist/lib/components/menus/ActionMenu.d.ts +4 -1
- package/dist/lib/components/menus/Menu.d.ts +19 -0
- package/dist/lib/index.d.ts +3 -1
- package/dist/lib/index.js +2582 -2054
- package/dist/lib/lib/actions.d.ts +3 -2
- package/dist/lib/lib/contract.d.ts +4 -0
- package/dist/lib/lib/notify.d.ts +4 -1
- package/dist/lib/lib/promotion.d.ts +17 -0
- package/dist/lib/lib/steps.d.ts +2 -1
- package/dist/lib/lib/surfaces.d.ts +10 -4
- package/dist/lib/studio.css +1 -1
- package/package.json +2 -2
- package/src/StudioApp.tsx +3 -2
- package/src/components/Dialog.tsx +74 -0
- package/src/components/DownloadScreenshot.tsx +13 -20
- package/src/components/EmptyState.tsx +32 -0
- package/src/components/InlineCode.tsx +7 -0
- package/src/components/OpenInApp.tsx +15 -14
- package/src/components/PaywallToasts.tsx +44 -37
- package/src/components/PreviewOnDevice.tsx +61 -43
- package/src/components/SuperwallLogo.tsx +72 -0
- package/src/components/SurfaceCard.tsx +34 -18
- package/src/components/Tooltip.tsx +25 -2
- package/src/components/chrome/StudioShell.tsx +1 -1
- package/src/components/chrome/Toolbar.tsx +10 -8
- package/src/components/chrome/TopBar.tsx +21 -22
- package/src/components/controls.tsx +116 -31
- package/src/components/icons.tsx +140 -59
- package/src/components/menus/ActionMenu.tsx +221 -97
- package/src/components/menus/CompareMenu.tsx +48 -67
- package/src/components/menus/Menu.tsx +144 -0
- package/src/components/panels/MissingProducts.tsx +27 -34
- package/src/components/panels/SidePanel.tsx +9 -9
- package/src/components/panels/VariablesPanel.tsx +57 -49
- package/src/components/preview/DeviceFrame.tsx +4 -6
- package/src/index.ts +9 -0
- package/src/lib/actions.ts +13 -4
- package/src/lib/contract.ts +2 -0
- package/src/lib/notify.tsx +15 -18
- package/src/lib/project.ts +1 -0
- package/src/lib/promotion.ts +47 -0
- package/src/lib/steps.ts +9 -1
- package/src/lib/surfaces.ts +22 -2
- package/src/main.tsx +22 -10
- package/src/screens/SurfaceEditor.tsx +101 -63
- package/src/screens/SurfaceList.tsx +112 -69
- package/src/scroll-fade.css +425 -0
- package/src/styles.css +380 -182
- package/dist/assets/index-CTn2zVi-.js +0 -11
- package/dist/assets/index-DrsTCwot.css +0 -1
package/src/lib/surfaces.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
StudioActionName,
|
|
3
|
+
StudioActionProgress,
|
|
4
|
+
StudioActionRequest,
|
|
5
|
+
StudioActionResult,
|
|
6
|
+
StudioStatus,
|
|
7
|
+
} from "./contract";
|
|
1
8
|
import type { StudioPresentation } from "./presentation";
|
|
2
9
|
import type { SampleDefaults } from "./variables";
|
|
3
10
|
|
|
@@ -8,6 +15,7 @@ export type {
|
|
|
8
15
|
Samples,
|
|
9
16
|
StudioActionName,
|
|
10
17
|
StudioActionProgress,
|
|
18
|
+
StudioActionRequest,
|
|
11
19
|
StudioActionResult,
|
|
12
20
|
StudioStatus,
|
|
13
21
|
StudioVersion,
|
|
@@ -20,6 +28,7 @@ export type StudioSurface = {
|
|
|
20
28
|
id: string;
|
|
21
29
|
project?: string;
|
|
22
30
|
label?: string;
|
|
31
|
+
version?: number;
|
|
23
32
|
products?: Record<string, string>;
|
|
24
33
|
routes: string[];
|
|
25
34
|
locales: string[];
|
|
@@ -66,6 +75,17 @@ export type CompareTarget =
|
|
|
66
75
|
| { type: "surface"; surface: StudioSurface }
|
|
67
76
|
| { type: "origin" };
|
|
68
77
|
|
|
78
|
+
export type StudioActions = {
|
|
79
|
+
offered: readonly StudioActionName[];
|
|
80
|
+
run(
|
|
81
|
+
surface: StudioSurface,
|
|
82
|
+
request: StudioActionRequest,
|
|
83
|
+
onStep?: StudioActionProgress,
|
|
84
|
+
): Promise<StudioActionResult>;
|
|
85
|
+
status(surface: StudioSurface): Promise<StudioStatus>;
|
|
86
|
+
pick?(version: number): void;
|
|
87
|
+
};
|
|
88
|
+
|
|
69
89
|
export type StudioSource = {
|
|
70
90
|
scheme?: string;
|
|
71
91
|
networkOrigin?: string;
|
|
@@ -75,10 +95,10 @@ export type StudioSource = {
|
|
|
75
95
|
samples?: SampleDefaults;
|
|
76
96
|
previewUrl: PreviewUrlBuilder;
|
|
77
97
|
standaloneUrl?: PreviewUrlBuilder;
|
|
78
|
-
|
|
98
|
+
actions?: StudioActions;
|
|
79
99
|
previewLink?: (surface: StudioSurface) => Promise<string>;
|
|
80
100
|
screenshotUrl?: (surface: StudioSurface) => Promise<string | undefined>;
|
|
81
101
|
compareHint?: string;
|
|
82
102
|
};
|
|
83
103
|
|
|
84
|
-
export const hasActions = (source: StudioSource): boolean => source.
|
|
104
|
+
export const hasActions = (source: StudioSource): boolean => source.actions !== undefined;
|
package/src/main.tsx
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { createRoot } from "react-dom/client";
|
|
3
|
+
import { StudioShell } from "./components/chrome/StudioShell";
|
|
4
|
+
import { EmptyState } from "./components/EmptyState";
|
|
5
|
+
import { AlertTriangleIcon } from "./components/icons";
|
|
6
|
+
import { InlineCode } from "./components/InlineCode";
|
|
7
|
+
import { devServerActions } from "./lib/actions";
|
|
3
8
|
import { buildPreviewPath, surfacePath } from "./lib/preview";
|
|
4
9
|
import { parseProjectPayload } from "./lib/project";
|
|
5
10
|
import { StudioApp } from "./StudioApp";
|
|
@@ -12,25 +17,32 @@ const loadSource = async (): Promise<StudioSource> => {
|
|
|
12
17
|
if (!response.ok) {
|
|
13
18
|
throw new Error(`project data unavailable (${response.status})`);
|
|
14
19
|
}
|
|
15
|
-
const payload = parseProjectPayload(await response.json());
|
|
20
|
+
const { capabilities, ...payload } = parseProjectPayload(await response.json());
|
|
16
21
|
return {
|
|
17
22
|
...payload,
|
|
23
|
+
...(capabilities.actions ? { actions: devServerActions } : {}),
|
|
18
24
|
previewUrl: buildPreviewPath,
|
|
19
25
|
standaloneUrl: (surface) => `/preview${surfacePath(surface)}`,
|
|
20
26
|
};
|
|
21
27
|
};
|
|
22
28
|
|
|
23
29
|
const Failure = ({ error }: { error: unknown }) => (
|
|
24
|
-
<
|
|
25
|
-
<div className="m-auto
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
<StudioShell>
|
|
31
|
+
<div className="m-auto">
|
|
32
|
+
<EmptyState
|
|
33
|
+
size="lg"
|
|
34
|
+
tone="destructive"
|
|
35
|
+
icon={<AlertTriangleIcon />}
|
|
36
|
+
title="Couldn’t load the studio"
|
|
37
|
+
description={
|
|
38
|
+
<>
|
|
39
|
+
{String(error)}. Is <InlineCode>superwall dev</InlineCode> running in a project
|
|
40
|
+
directory?
|
|
41
|
+
</>
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
32
44
|
</div>
|
|
33
|
-
</
|
|
45
|
+
</StudioShell>
|
|
34
46
|
);
|
|
35
47
|
|
|
36
48
|
const root = createRoot(document.getElementById("root")!);
|
|
@@ -16,13 +16,17 @@ import { DownloadScreenshot } from "../components/DownloadScreenshot";
|
|
|
16
16
|
import { PreviewOnDevice } from "../components/PreviewOnDevice";
|
|
17
17
|
import { Segmented, Select, Switch } from "../components/controls";
|
|
18
18
|
import {
|
|
19
|
+
AlertTriangleIcon,
|
|
19
20
|
ExternalIcon,
|
|
21
|
+
MinusIcon,
|
|
20
22
|
MoonIcon,
|
|
23
|
+
PlusIcon,
|
|
21
24
|
RotateDeviceIcon,
|
|
22
25
|
RotateIcon,
|
|
23
26
|
SlidersIcon,
|
|
24
27
|
SunIcon,
|
|
25
28
|
} from "../components/icons";
|
|
29
|
+
import { Tooltip } from "../components/Tooltip";
|
|
26
30
|
import { SidePanel } from "../components/panels/SidePanel";
|
|
27
31
|
import { Toolbar, ToolbarDivider, ToolbarGroup } from "../components/chrome/Toolbar";
|
|
28
32
|
import { TopBar } from "../components/chrome/TopBar";
|
|
@@ -31,7 +35,6 @@ import {
|
|
|
31
35
|
type VariableGroups,
|
|
32
36
|
type VariableRow,
|
|
33
37
|
} from "../components/panels/VariablesPanel";
|
|
34
|
-
import { fetchStatus, runAction } from "../lib/actions";
|
|
35
38
|
import {
|
|
36
39
|
chromeFor,
|
|
37
40
|
DEFAULT_DEVICE_ID,
|
|
@@ -47,9 +50,9 @@ import {
|
|
|
47
50
|
import { hostStateFor, previewDevice, studioDefaults } from "../lib/host";
|
|
48
51
|
import { percent } from "../lib/canvas";
|
|
49
52
|
import { hostedUrl, originalUrl } from "../lib/preview";
|
|
53
|
+
import { latestVersion, liveVersion } from "../lib/promotion";
|
|
50
54
|
import { ACTION_STEPS, type StudioActionStep, type StudioStepState } from "../lib/steps";
|
|
51
55
|
import {
|
|
52
|
-
hasActions,
|
|
53
56
|
hasOriginal,
|
|
54
57
|
isScreenOrigin,
|
|
55
58
|
SCREEN_FRAMEWORK_LABEL,
|
|
@@ -65,6 +68,9 @@ import {
|
|
|
65
68
|
import { timeAgo } from "../lib/time";
|
|
66
69
|
import { type VariableOverrides } from "../lib/variables";
|
|
67
70
|
|
|
71
|
+
const STEPPER =
|
|
72
|
+
"flex w-8 items-center justify-center outline-none transition-colors duration-hover hover:bg-accent focus-visible:bg-accent hover:[&>svg]:filter-none focus-visible:[&>svg]:filter-none";
|
|
73
|
+
|
|
68
74
|
const clampSize = (value: number, fallback: number): number =>
|
|
69
75
|
Number.isFinite(value) ? Math.min(3000, Math.max(200, Math.round(value))) : fallback;
|
|
70
76
|
|
|
@@ -90,7 +96,7 @@ const SizeInput = ({
|
|
|
90
96
|
|
|
91
97
|
return (
|
|
92
98
|
<input
|
|
93
|
-
className="sw-input w-16 text-center"
|
|
99
|
+
className="sw-input w-16 text-center tabular-nums"
|
|
94
100
|
type="number"
|
|
95
101
|
aria-label={label}
|
|
96
102
|
value={draft}
|
|
@@ -145,7 +151,7 @@ const StagePane = ({
|
|
|
145
151
|
<div className="flex flex-none flex-col gap-2">
|
|
146
152
|
{label && (
|
|
147
153
|
<span
|
|
148
|
-
className="origin-bottom-left text-xs whitespace-nowrap text-
|
|
154
|
+
className="origin-bottom-left text-xs whitespace-nowrap text-fg-tertiary"
|
|
149
155
|
style={{ transform: `scale(${1 / scale})` }}
|
|
150
156
|
>
|
|
151
157
|
{label}
|
|
@@ -229,32 +235,36 @@ export const SurfaceEditor = ({
|
|
|
229
235
|
const canvas = React.useRef<CanvasHandle>(null);
|
|
230
236
|
const [zoom, setZoom] = React.useState<CanvasZoom>({ scale: 1, fitted: true });
|
|
231
237
|
const [status, setStatus] = React.useState<StudioStatus>({});
|
|
238
|
+
const [picked, setPicked] = React.useState<number | undefined>(undefined);
|
|
232
239
|
const [progress, setProgress] = React.useState<ActionProgress | undefined>(undefined);
|
|
233
240
|
const dismissTimer = React.useRef<number | undefined>(undefined);
|
|
234
241
|
React.useEffect(() => () => window.clearTimeout(dismissTimer.current), []);
|
|
235
242
|
|
|
236
|
-
const
|
|
243
|
+
const shipping = source.actions;
|
|
237
244
|
const delegate = useStudioDelegate();
|
|
238
245
|
const defaults = React.useMemo(studioDefaults, [surface]);
|
|
239
246
|
|
|
240
247
|
const locales = surface.locales;
|
|
241
248
|
|
|
242
249
|
React.useEffect(() => {
|
|
243
|
-
if (!
|
|
250
|
+
if (!shipping) return;
|
|
244
251
|
let cancelled = false;
|
|
245
|
-
|
|
252
|
+
setPicked(undefined);
|
|
253
|
+
shipping.status(surface).then((value) => {
|
|
246
254
|
if (!cancelled) setStatus(value);
|
|
247
255
|
});
|
|
248
256
|
return () => {
|
|
249
257
|
cancelled = true;
|
|
250
258
|
};
|
|
251
|
-
}, [
|
|
259
|
+
}, [shipping, surface]);
|
|
252
260
|
|
|
253
261
|
const ship = async (action: StudioActionName) => {
|
|
262
|
+
if (!shipping) return;
|
|
254
263
|
window.clearTimeout(dismissTimer.current);
|
|
255
264
|
setProgress({ action, steps: {} });
|
|
256
265
|
|
|
257
|
-
const
|
|
266
|
+
const version = action === "promote" ? (surface.version ?? picked) : undefined;
|
|
267
|
+
const result = await shipping.run(surface, { action, version }, (step, state) => {
|
|
258
268
|
setProgress((current) =>
|
|
259
269
|
current?.action === action
|
|
260
270
|
? {
|
|
@@ -270,7 +280,8 @@ export const SurfaceEditor = ({
|
|
|
270
280
|
ACTION_STEPS[action].map((step) => [step, "done"]),
|
|
271
281
|
) as Partial<Record<StudioActionStep, StudioStepState>>;
|
|
272
282
|
setProgress({ action, steps });
|
|
273
|
-
|
|
283
|
+
setPicked(undefined);
|
|
284
|
+
setStatus(await shipping.status(surface));
|
|
274
285
|
dismissTimer.current = window.setTimeout(() => setProgress(undefined), 1600);
|
|
275
286
|
} else {
|
|
276
287
|
setProgress((current) => {
|
|
@@ -330,7 +341,13 @@ export const SurfaceEditor = ({
|
|
|
330
341
|
const chrome = responsive ? undefined : chromeFor(device, web);
|
|
331
342
|
const previewSrc = source.previewUrl(surface);
|
|
332
343
|
const versions = status.versions ?? [];
|
|
333
|
-
const
|
|
344
|
+
const promotion = {
|
|
345
|
+
target: surface.version ?? picked ?? latestVersion(versions),
|
|
346
|
+
live: liveVersion(versions),
|
|
347
|
+
versions,
|
|
348
|
+
pick: surface.version === undefined ? setPicked : shipping?.pick,
|
|
349
|
+
};
|
|
350
|
+
const versionLabel = (entry: StudioVersion) => `v${entry.version}${entry.live ? " · Live" : ""}`;
|
|
334
351
|
const pushedHint = (entry: StudioVersion) => {
|
|
335
352
|
if (entry.live) return "What SDKs receive today";
|
|
336
353
|
const ago = entry.pushedAt ? timeAgo(entry.pushedAt) : undefined;
|
|
@@ -366,7 +383,7 @@ export const SurfaceEditor = ({
|
|
|
366
383
|
.filter((option) => option.target.surface !== surface),
|
|
367
384
|
];
|
|
368
385
|
const compareNotice = status.unreachable
|
|
369
|
-
? `Couldn
|
|
386
|
+
? `Couldn’t read the pushed versions — ${status.unreachable}`
|
|
370
387
|
: undefined;
|
|
371
388
|
const compared =
|
|
372
389
|
compareWith?.type === "version"
|
|
@@ -391,7 +408,7 @@ export const SurfaceEditor = ({
|
|
|
391
408
|
title: `${surface.id} original`,
|
|
392
409
|
empty:
|
|
393
410
|
surface.origin && isScreenOrigin(surface.origin)
|
|
394
|
-
? "The original
|
|
411
|
+
? "The original’s screenshot is missing — capture it again with `superwall migrate --screen <path> --screenshot <file>`."
|
|
395
412
|
: "This paywall was not rebuilt from a dashboard paywall or a native screen.",
|
|
396
413
|
}
|
|
397
414
|
: {
|
|
@@ -454,34 +471,42 @@ export const SurfaceEditor = ({
|
|
|
454
471
|
/>
|
|
455
472
|
)}
|
|
456
473
|
<TopBar
|
|
457
|
-
title={`${surface.project ?? source.title} / ${surface.id}${
|
|
458
|
-
surface.label ? ` · ${surface.
|
|
474
|
+
title={`${surface.project ?? source.title} / ${surface.label ?? surface.id}${
|
|
475
|
+
surface.label ? ` · ${surface.id}` : ""
|
|
459
476
|
}`}
|
|
460
477
|
actions={
|
|
461
478
|
<>
|
|
462
479
|
{actions}
|
|
463
|
-
<
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
480
|
+
<span className="flex items-center gap-0.5">
|
|
481
|
+
<Tooltip hint="Reload preview">
|
|
482
|
+
<button
|
|
483
|
+
type="button"
|
|
484
|
+
className="sw-btn sw-btn--sm sw-btn--icon sw-btn--ghost"
|
|
485
|
+
aria-label="Reload preview"
|
|
486
|
+
onClick={() => setReloadKey((key) => key + 1)}
|
|
487
|
+
>
|
|
488
|
+
<RotateIcon />
|
|
489
|
+
</button>
|
|
490
|
+
</Tooltip>
|
|
491
|
+
{source.standaloneUrl && (
|
|
492
|
+
<Tooltip hint="Open preview">
|
|
493
|
+
<button
|
|
494
|
+
type="button"
|
|
495
|
+
className="sw-btn sw-btn--sm sw-btn--icon sw-btn--ghost"
|
|
496
|
+
aria-label="Open preview"
|
|
497
|
+
onClick={openPreview}
|
|
498
|
+
>
|
|
499
|
+
<ExternalIcon />
|
|
500
|
+
</button>
|
|
501
|
+
</Tooltip>
|
|
502
|
+
)}
|
|
503
|
+
<DownloadScreenshot source={source} surface={surface} />
|
|
504
|
+
</span>
|
|
482
505
|
<PreviewOnDevice source={source} surface={surface} />
|
|
483
|
-
{
|
|
506
|
+
{shipping && (
|
|
484
507
|
<ActionMenu
|
|
508
|
+
offered={shipping.offered}
|
|
509
|
+
promotion={promotion}
|
|
485
510
|
progress={progress}
|
|
486
511
|
blocked={
|
|
487
512
|
shippable
|
|
@@ -500,9 +525,13 @@ export const SurfaceEditor = ({
|
|
|
500
525
|
{unverified && (
|
|
501
526
|
<div
|
|
502
527
|
role="status"
|
|
503
|
-
className="relative z-10 flex-none border-b border-
|
|
528
|
+
className="relative z-10 flex flex-none items-center gap-2 border-b border-border bg-warning/8 px-4 py-2 text-sm text-warning-foreground"
|
|
504
529
|
>
|
|
505
|
-
|
|
530
|
+
<AlertTriangleIcon />
|
|
531
|
+
<span className="min-w-0 truncate">
|
|
532
|
+
Couldn’t check this paywall’s products{" "}
|
|
533
|
+
<span className="text-warning-foreground/80">· {unverified}</span>
|
|
534
|
+
</span>
|
|
506
535
|
</div>
|
|
507
536
|
)}
|
|
508
537
|
|
|
@@ -581,51 +610,60 @@ export const SurfaceEditor = ({
|
|
|
581
610
|
label="Theme"
|
|
582
611
|
value={theme}
|
|
583
612
|
options={[
|
|
584
|
-
{ value: "light", label: <SunIcon
|
|
585
|
-
{ value: "dark", label: <MoonIcon
|
|
613
|
+
{ value: "light", label: <SunIcon />, name: "Light" },
|
|
614
|
+
{ value: "dark", label: <MoonIcon />, name: "Dark" },
|
|
586
615
|
]}
|
|
587
616
|
onChange={setTheme}
|
|
588
617
|
/>
|
|
589
|
-
<
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
aria-pressed={landscape}
|
|
594
|
-
title={landscape ? "Back to portrait" : "Rotate to landscape"}
|
|
595
|
-
onClick={() => setLandscape((value) => !value)}
|
|
618
|
+
<Tooltip
|
|
619
|
+
side="top"
|
|
620
|
+
align="center"
|
|
621
|
+
hint={landscape ? "Back to portrait" : "Rotate to landscape"}
|
|
596
622
|
>
|
|
597
|
-
<
|
|
598
|
-
|
|
623
|
+
<button
|
|
624
|
+
type="button"
|
|
625
|
+
className="sw-btn sw-btn--icon"
|
|
626
|
+
aria-label="Rotate device"
|
|
627
|
+
aria-pressed={landscape}
|
|
628
|
+
onClick={() => setLandscape((value) => !value)}
|
|
599
629
|
>
|
|
600
|
-
<RotateDeviceIcon
|
|
601
|
-
|
|
602
|
-
|
|
630
|
+
<RotateDeviceIcon
|
|
631
|
+
className={`transition-disclosure ${landscape ? "-rotate-90" : ""}`}
|
|
632
|
+
/>
|
|
633
|
+
</button>
|
|
634
|
+
</Tooltip>
|
|
603
635
|
</ToolbarGroup>
|
|
604
636
|
<ToolbarDivider />
|
|
605
637
|
<ToolbarGroup label="Zoom">
|
|
606
|
-
<div
|
|
638
|
+
<div
|
|
639
|
+
className="flex h-8 flex-none overflow-hidden rounded-sm border border-border transition-colors duration-hover has-[:focus-visible]:border-primary"
|
|
640
|
+
role="group"
|
|
641
|
+
aria-label="Zoom"
|
|
642
|
+
>
|
|
607
643
|
<button
|
|
608
644
|
type="button"
|
|
645
|
+
className={STEPPER}
|
|
609
646
|
aria-label="Zoom out"
|
|
610
647
|
onClick={() => canvas.current?.zoomStep(-1)}
|
|
611
648
|
>
|
|
612
|
-
<
|
|
613
|
-
<path d="M5 12h14" />
|
|
614
|
-
</svg>
|
|
649
|
+
<MinusIcon className="icon-tertiary" />
|
|
615
650
|
</button>
|
|
616
651
|
<button
|
|
617
652
|
type="button"
|
|
618
|
-
className="min-w-
|
|
653
|
+
className="min-w-14 border-x border-border px-2 text-sm tabular-nums outline-none transition-colors duration-hover hover:bg-accent focus-visible:bg-accent"
|
|
619
654
|
aria-label="Fit to view"
|
|
620
655
|
aria-pressed={zoom.fitted}
|
|
621
656
|
onClick={() => canvas.current?.fit()}
|
|
622
657
|
>
|
|
623
658
|
{percent(zoom.scale)}
|
|
624
659
|
</button>
|
|
625
|
-
<button
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
660
|
+
<button
|
|
661
|
+
type="button"
|
|
662
|
+
className={STEPPER}
|
|
663
|
+
aria-label="Zoom in"
|
|
664
|
+
onClick={() => canvas.current?.zoomStep(1)}
|
|
665
|
+
>
|
|
666
|
+
<PlusIcon className="icon-tertiary" />
|
|
629
667
|
</button>
|
|
630
668
|
</div>
|
|
631
669
|
</ToolbarGroup>
|
|
@@ -646,7 +684,7 @@ export const SurfaceEditor = ({
|
|
|
646
684
|
value={frame.width}
|
|
647
685
|
onCommit={(width) => setSize((current) => ({ ...current, width }))}
|
|
648
686
|
/>
|
|
649
|
-
<span className="text-
|
|
687
|
+
<span className="text-fg-tertiary">×</span>
|
|
650
688
|
<SizeInput
|
|
651
689
|
label="Preview height"
|
|
652
690
|
value={frame.height}
|
|
@@ -669,7 +707,7 @@ export const SurfaceEditor = ({
|
|
|
669
707
|
</ToolbarGroup>
|
|
670
708
|
)}
|
|
671
709
|
<ToolbarDivider />
|
|
672
|
-
{(
|
|
710
|
+
{(shipping || compareOptions.length > 0) && (
|
|
673
711
|
<CompareMenu
|
|
674
712
|
active={compareWith}
|
|
675
713
|
options={compareOptions}
|
|
@@ -685,7 +723,7 @@ export const SurfaceEditor = ({
|
|
|
685
723
|
>
|
|
686
724
|
<SlidersIcon />
|
|
687
725
|
Variables
|
|
688
|
-
{overrideCount > 0 && <span className="text-
|
|
726
|
+
{overrideCount > 0 && <span className="text-primary tabular-nums">{overrideCount}</span>}
|
|
689
727
|
</button>
|
|
690
728
|
</Toolbar>
|
|
691
729
|
</>
|