@superwall/studio 1.1.1 → 1.3.0-beta.3
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 +61 -11
- package/dist/assets/index-DyLb5fiB.js +11 -0
- package/dist/assets/index-_HCp6gCi.css +1 -0
- package/dist/index.html +2 -2
- package/dist/lib/StudioApp.d.ts +6 -0
- package/dist/lib/components/OpenInApp.d.ts +5 -0
- package/dist/lib/components/PaywallToasts.d.ts +8 -0
- package/dist/lib/components/SurfaceCard.d.ts +11 -0
- package/dist/lib/components/chrome/StudioShell.d.ts +4 -0
- package/dist/lib/components/chrome/Toolbar.d.ts +6 -0
- package/dist/lib/components/chrome/TopBar.d.ts +8 -0
- package/dist/lib/components/controls.d.ts +24 -0
- package/dist/lib/components/icons.d.ts +18 -0
- package/dist/lib/components/menus/ActionMenu.d.ts +14 -0
- package/dist/lib/components/menus/CompareMenu.d.ts +13 -0
- package/dist/lib/components/panels/MissingProducts.d.ts +8 -0
- package/dist/lib/components/panels/SidePanel.d.ts +6 -0
- package/dist/lib/components/panels/VariablesPanel.d.ts +13 -0
- package/dist/lib/components/preview/DeviceChrome.d.ts +12 -0
- package/dist/lib/components/preview/DeviceFrame.d.ts +21 -0
- package/dist/lib/components/preview/HostedIframe.d.ts +7 -0
- package/dist/lib/icon.svg +5 -0
- package/dist/lib/index.d.ts +20 -0
- package/dist/lib/index.js +2268 -0
- package/dist/lib/lib/actions.d.ts +4 -0
- package/dist/lib/lib/contract.d.ts +33 -0
- package/dist/lib/lib/devices.d.ts +26 -0
- package/dist/lib/lib/host.d.ts +15 -0
- package/dist/lib/lib/notices.d.ts +9 -0
- package/dist/lib/lib/preview.d.ts +5 -0
- package/dist/lib/lib/products.d.ts +16 -0
- package/dist/lib/lib/project.d.ts +13 -0
- package/dist/lib/lib/steps.d.ts +5 -0
- package/dist/lib/lib/surfaces.d.ts +35 -0
- package/dist/lib/lib/time.d.ts +1 -0
- package/dist/lib/lib/variables.d.ts +12 -0
- package/dist/lib/products.js +65 -0
- package/dist/lib/screens/SurfaceEditor.d.ts +9 -0
- package/dist/lib/screens/SurfaceList.d.ts +7 -0
- package/dist/lib/studio.css +1 -0
- package/package.json +19 -4
- package/src/StudioApp.tsx +8 -11
- package/src/components/PaywallToasts.tsx +162 -85
- package/src/components/SurfaceCard.tsx +9 -2
- package/src/components/chrome/StudioShell.tsx +12 -0
- package/src/components/icons.tsx +0 -13
- package/src/components/{ActionMenu.tsx → menus/ActionMenu.tsx} +4 -4
- package/src/components/{CompareMenu.tsx → menus/CompareMenu.tsx} +3 -3
- package/src/components/{SidePanel.tsx → panels/SidePanel.tsx} +1 -1
- package/src/components/{VariablesPanel.tsx → panels/VariablesPanel.tsx} +4 -4
- package/src/components/{DeviceChrome.tsx → preview/DeviceChrome.tsx} +1 -1
- package/src/components/{DeviceFrame.tsx → preview/DeviceFrame.tsx} +14 -55
- package/src/components/preview/HostedIframe.tsx +46 -0
- package/src/index.ts +26 -6
- package/src/lib/actions.ts +1 -1
- package/src/lib/contract.ts +30 -0
- package/src/lib/devices.ts +5 -4
- package/src/lib/host.ts +80 -0
- package/src/lib/notices.ts +63 -0
- package/src/lib/preview.ts +11 -33
- package/src/lib/products.ts +116 -0
- package/src/lib/project.ts +2 -1
- package/src/lib/steps.ts +20 -0
- package/src/lib/surfaces.ts +41 -0
- package/src/lib/time.ts +1 -2
- package/src/lib/variables.ts +13 -0
- package/src/main.tsx +3 -3
- package/src/screens/SurfaceEditor.tsx +97 -67
- package/src/screens/SurfaceList.tsx +17 -7
- package/src/styles.css +8 -6
- package/src/vite-env.d.ts +1 -0
- package/dist/assets/index-CVKGrx00.js +0 -11
- package/dist/assets/index-D4RIpSbg.css +0 -1
- package/src/lib/events.ts +0 -77
- package/src/lib/types.ts +0 -85
- /package/src/components/{Toolbar.tsx → chrome/Toolbar.tsx} +0 -0
- /package/src/components/{TopBar.tsx → chrome/TopBar.tsx} +0 -0
- /package/src/components/{MissingProducts.tsx → panels/MissingProducts.tsx} +0 -0
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { hasIntroductoryOffer, type HostDelegate, type HostState } from "@superwall/host";
|
|
3
|
+
import { ActionMenu, type ActionProgress } from "../components/menus/ActionMenu";
|
|
4
|
+
import { CompareMenu, type CompareOption } from "../components/menus/CompareMenu";
|
|
5
|
+
import { DeviceFrame, DevicePlaceholder } from "../components/preview/DeviceFrame";
|
|
6
|
+
import { MissingProducts } from "../components/panels/MissingProducts";
|
|
7
|
+
import { PaywallToasts, useStudioDelegate } from "../components/PaywallToasts";
|
|
7
8
|
import { Segmented, Select, Switch } from "../components/controls";
|
|
8
9
|
import {
|
|
9
10
|
ExternalIcon,
|
|
@@ -13,14 +14,14 @@ import {
|
|
|
13
14
|
SlidersIcon,
|
|
14
15
|
SunIcon,
|
|
15
16
|
} from "../components/icons";
|
|
16
|
-
import { SidePanel } from "../components/SidePanel";
|
|
17
|
-
import { Toolbar, ToolbarDivider, ToolbarGroup } from "../components/Toolbar";
|
|
18
|
-
import { TopBar } from "../components/TopBar";
|
|
17
|
+
import { SidePanel } from "../components/panels/SidePanel";
|
|
18
|
+
import { Toolbar, ToolbarDivider, ToolbarGroup } from "../components/chrome/Toolbar";
|
|
19
|
+
import { TopBar } from "../components/chrome/TopBar";
|
|
19
20
|
import {
|
|
20
21
|
VariablesPanel,
|
|
21
22
|
type VariableGroups,
|
|
22
23
|
type VariableRow,
|
|
23
|
-
} from "../components/VariablesPanel";
|
|
24
|
+
} from "../components/panels/VariablesPanel";
|
|
24
25
|
import { fetchStatus, runAction } from "../lib/actions";
|
|
25
26
|
import {
|
|
26
27
|
DEFAULT_DEVICE_ID,
|
|
@@ -30,19 +31,18 @@ import {
|
|
|
30
31
|
STUDIO_DEVICES,
|
|
31
32
|
type DeviceChromeSpec,
|
|
32
33
|
} from "../lib/devices";
|
|
33
|
-
import {
|
|
34
|
+
import { hostStateFor, studioDefaults } from "../lib/host";
|
|
35
|
+
import { hostedUrl } from "../lib/preview";
|
|
36
|
+
import { ACTION_STEPS, type StudioActionStep, type StudioStepState } from "../lib/steps";
|
|
34
37
|
import {
|
|
35
|
-
ACTION_STEPS,
|
|
36
38
|
type CompareTarget,
|
|
37
|
-
type PreviewOverrides,
|
|
38
|
-
type StudioActionName,
|
|
39
|
-
type StudioActionStep,
|
|
40
39
|
type Samples,
|
|
40
|
+
type StudioActionName,
|
|
41
41
|
type StudioSource,
|
|
42
42
|
type StudioStatus,
|
|
43
|
-
type StudioStepState,
|
|
44
43
|
type StudioSurface,
|
|
45
|
-
} from "../lib/
|
|
44
|
+
} from "../lib/surfaces";
|
|
45
|
+
import { type VariableOverrides } from "../lib/variables";
|
|
46
46
|
|
|
47
47
|
const clampSize = (value: number, fallback: number): number =>
|
|
48
48
|
Number.isFinite(value) ? Math.min(3000, Math.max(200, Math.round(value))) : fallback;
|
|
@@ -88,6 +88,8 @@ const StagePane = ({
|
|
|
88
88
|
height,
|
|
89
89
|
title,
|
|
90
90
|
src,
|
|
91
|
+
hostState,
|
|
92
|
+
delegate,
|
|
91
93
|
reloadKey,
|
|
92
94
|
empty,
|
|
93
95
|
chrome,
|
|
@@ -99,6 +101,8 @@ const StagePane = ({
|
|
|
99
101
|
height: number;
|
|
100
102
|
title: string;
|
|
101
103
|
src?: string;
|
|
104
|
+
hostState: HostState;
|
|
105
|
+
delegate: HostDelegate;
|
|
102
106
|
reloadKey: number;
|
|
103
107
|
empty?: string;
|
|
104
108
|
chrome?: DeviceChromeSpec;
|
|
@@ -116,6 +120,8 @@ const StagePane = ({
|
|
|
116
120
|
height={height}
|
|
117
121
|
title={title}
|
|
118
122
|
src={src}
|
|
123
|
+
hostState={hostState}
|
|
124
|
+
delegate={delegate}
|
|
119
125
|
stageRef={paneRef}
|
|
120
126
|
reloadKey={reloadKey}
|
|
121
127
|
chrome={chrome}
|
|
@@ -132,22 +138,26 @@ const StagePane = ({
|
|
|
132
138
|
);
|
|
133
139
|
};
|
|
134
140
|
|
|
141
|
+
const nameOf = (surface: StudioSurface): string => surface.label ?? `${surface.kind}/${surface.id}`;
|
|
142
|
+
|
|
135
143
|
export const SurfaceEditor = ({
|
|
136
144
|
source,
|
|
137
145
|
surface,
|
|
138
146
|
samples,
|
|
139
147
|
onBack,
|
|
148
|
+
actions,
|
|
140
149
|
}: {
|
|
141
150
|
source: StudioSource;
|
|
142
151
|
surface: StudioSurface;
|
|
143
152
|
samples: Samples;
|
|
144
153
|
onBack: () => void;
|
|
154
|
+
actions?: React.ReactNode;
|
|
145
155
|
}) => {
|
|
146
156
|
const [deviceId, setDeviceId] = React.useState(DEFAULT_DEVICE_ID);
|
|
147
157
|
const [size, setSize] = React.useState(RESPONSIVE_DEFAULT);
|
|
148
158
|
const [theme, setTheme] = React.useState<"light" | "dark">("light");
|
|
149
159
|
const [locale, setLocale] = React.useState<string | undefined>(undefined);
|
|
150
|
-
const [edited, setEdited] = React.useState<
|
|
160
|
+
const [edited, setEdited] = React.useState<VariableOverrides>({});
|
|
151
161
|
const [panelOpen, setPanelOpen] = React.useState(false);
|
|
152
162
|
const [compareWith, setCompareWith] = React.useState<CompareTarget | undefined>(undefined);
|
|
153
163
|
const [reloadKey, setReloadKey] = React.useState(0);
|
|
@@ -158,6 +168,10 @@ export const SurfaceEditor = ({
|
|
|
158
168
|
React.useEffect(() => () => window.clearTimeout(dismissTimer.current), []);
|
|
159
169
|
|
|
160
170
|
const actionsEnabled = source.capabilities?.actions === true;
|
|
171
|
+
const delegate = useStudioDelegate();
|
|
172
|
+
const defaults = React.useMemo(studioDefaults, [surface]);
|
|
173
|
+
|
|
174
|
+
const locales = surface.locales;
|
|
161
175
|
|
|
162
176
|
React.useEffect(() => {
|
|
163
177
|
if (!actionsEnabled) return;
|
|
@@ -204,41 +218,45 @@ export const SurfaceEditor = ({
|
|
|
204
218
|
}
|
|
205
219
|
};
|
|
206
220
|
|
|
221
|
+
const responsive = deviceId === RESPONSIVE_ID;
|
|
222
|
+
const device = deviceById(deviceId);
|
|
223
|
+
const upright = responsive ? size : { width: device.width, height: device.height };
|
|
224
|
+
const frame = landscape ? { width: upright.height, height: upright.width } : upright;
|
|
225
|
+
|
|
207
226
|
const openPreview = () => {
|
|
227
|
+
const standalone = source.standaloneUrl?.(surface);
|
|
228
|
+
if (standalone === undefined) return;
|
|
208
229
|
if (frame.width > 768) {
|
|
209
|
-
window.open(
|
|
230
|
+
window.open(standalone, "_blank");
|
|
210
231
|
return;
|
|
211
232
|
}
|
|
212
233
|
const left = Math.max(0, window.screen.width / 2 - frame.width / 2);
|
|
213
234
|
const top = Math.max(0, window.screen.height / 2 - frame.height / 2);
|
|
214
235
|
const popup = window.open(
|
|
215
|
-
|
|
236
|
+
standalone,
|
|
216
237
|
"superwall-preview",
|
|
217
238
|
`toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=${frame.width},height=${frame.height},top=${top},left=${left}`,
|
|
218
239
|
);
|
|
219
|
-
if (!popup) window.open(
|
|
240
|
+
if (!popup) window.open(standalone, "_blank");
|
|
220
241
|
};
|
|
221
242
|
|
|
222
|
-
const
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
device
|
|
235
|
-
|
|
236
|
-
...edited.device,
|
|
237
|
-
},
|
|
238
|
-
};
|
|
243
|
+
const hostState = React.useMemo(
|
|
244
|
+
() =>
|
|
245
|
+
hostStateFor({
|
|
246
|
+
surface,
|
|
247
|
+
defaults,
|
|
248
|
+
sourceSamples: source.samples,
|
|
249
|
+
samples,
|
|
250
|
+
frame: responsive ? undefined : device.device,
|
|
251
|
+
theme,
|
|
252
|
+
locale,
|
|
253
|
+
edited,
|
|
254
|
+
}),
|
|
255
|
+
[surface, defaults, source.samples, samples, responsive, device.device, theme, locale, edited],
|
|
256
|
+
);
|
|
239
257
|
const chrome = responsive ? undefined : device.chrome;
|
|
240
|
-
const previewSrc = source.previewUrl(surface
|
|
241
|
-
const liveSrc = status.liveUrl ?
|
|
258
|
+
const previewSrc = source.previewUrl(surface);
|
|
259
|
+
const liveSrc = status.liveUrl ? hostedUrl(status.liveUrl) : undefined;
|
|
242
260
|
|
|
243
261
|
const compareOptions: CompareOption[] = [
|
|
244
262
|
...(actionsEnabled
|
|
@@ -252,13 +270,13 @@ export const SurfaceEditor = ({
|
|
|
252
270
|
]
|
|
253
271
|
: []),
|
|
254
272
|
...source.surfaces
|
|
255
|
-
.
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
hint: "Local preview",
|
|
273
|
+
.map((candidate, index) => ({
|
|
274
|
+
key: `surface:${index}`,
|
|
275
|
+
label: nameOf(candidate),
|
|
276
|
+
hint: source.compareHint ?? "Local preview",
|
|
260
277
|
target: { type: "surface", surface: candidate } as const,
|
|
261
|
-
}))
|
|
278
|
+
}))
|
|
279
|
+
.filter((option) => option.target.surface !== surface),
|
|
262
280
|
];
|
|
263
281
|
|
|
264
282
|
const comparePane =
|
|
@@ -273,9 +291,9 @@ export const SurfaceEditor = ({
|
|
|
273
291
|
: undefined,
|
|
274
292
|
}
|
|
275
293
|
: {
|
|
276
|
-
label:
|
|
277
|
-
src: source.previewUrl(compareWith.surface
|
|
278
|
-
title: `${compareWith.surface
|
|
294
|
+
label: nameOf(compareWith.surface),
|
|
295
|
+
src: source.previewUrl(compareWith.surface),
|
|
296
|
+
title: `${nameOf(compareWith.surface)} preview`,
|
|
279
297
|
});
|
|
280
298
|
|
|
281
299
|
const groups = React.useMemo((): VariableGroups => {
|
|
@@ -285,18 +303,19 @@ export const SurfaceEditor = ({
|
|
|
285
303
|
.toSorted((a, b) => a.path.localeCompare(b.path));
|
|
286
304
|
|
|
287
305
|
return {
|
|
288
|
-
user: rows("user", { ...source.samples?.user, ...samples.user }),
|
|
306
|
+
user: rows("user", { ...defaults.user, ...source.samples?.user, ...samples.user }),
|
|
289
307
|
device: rows("device", {
|
|
308
|
+
...defaults.device,
|
|
290
309
|
...source.samples?.device,
|
|
291
310
|
...samples.device,
|
|
292
311
|
...(device.device as Record<string, unknown>),
|
|
293
312
|
}),
|
|
294
|
-
params: rows("params", source.samples?.params),
|
|
313
|
+
params: rows("params", { ...defaults.params, ...source.samples?.params }),
|
|
295
314
|
products: Object.entries(surface.products ?? {}).flatMap(([reference, identifier]) =>
|
|
296
315
|
rows(`products.${reference}`, samples.products?.[identifier]),
|
|
297
316
|
),
|
|
298
317
|
};
|
|
299
|
-
}, [source.samples, samples, device.device, surface.products]);
|
|
318
|
+
}, [defaults, source.samples, samples, device.device, surface.products]);
|
|
300
319
|
|
|
301
320
|
const missingProducts = React.useMemo(() => {
|
|
302
321
|
if (!samples.products) return [];
|
|
@@ -333,10 +352,13 @@ export const SurfaceEditor = ({
|
|
|
333
352
|
</div>
|
|
334
353
|
)}
|
|
335
354
|
<TopBar
|
|
336
|
-
title={`${surface.project ?? source.title} / ${surface.id}
|
|
355
|
+
title={`${surface.project ?? source.title} / ${surface.id}${
|
|
356
|
+
surface.label ? ` · ${surface.label}` : ""
|
|
357
|
+
}`}
|
|
337
358
|
onHome={onBack}
|
|
338
359
|
actions={
|
|
339
360
|
<>
|
|
361
|
+
{actions}
|
|
340
362
|
<button
|
|
341
363
|
type="button"
|
|
342
364
|
className="sw-btn sw-btn--icon"
|
|
@@ -345,14 +367,16 @@ export const SurfaceEditor = ({
|
|
|
345
367
|
>
|
|
346
368
|
<RotateIcon />
|
|
347
369
|
</button>
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
370
|
+
{source.standaloneUrl && (
|
|
371
|
+
<button
|
|
372
|
+
type="button"
|
|
373
|
+
className="sw-btn sw-btn--icon"
|
|
374
|
+
aria-label="Open preview"
|
|
375
|
+
onClick={openPreview}
|
|
376
|
+
>
|
|
377
|
+
<ExternalIcon />
|
|
378
|
+
</button>
|
|
379
|
+
)}
|
|
356
380
|
{actionsEnabled && (
|
|
357
381
|
<ActionMenu
|
|
358
382
|
progress={progress}
|
|
@@ -380,6 +404,8 @@ export const SurfaceEditor = ({
|
|
|
380
404
|
height={frame.height}
|
|
381
405
|
title={comparePane.title}
|
|
382
406
|
src={comparePane.src}
|
|
407
|
+
hostState={hostState}
|
|
408
|
+
delegate={delegate}
|
|
383
409
|
reloadKey={reloadKey}
|
|
384
410
|
empty={"empty" in comparePane ? comparePane.empty : undefined}
|
|
385
411
|
chrome={chrome}
|
|
@@ -388,11 +414,13 @@ export const SurfaceEditor = ({
|
|
|
388
414
|
/>
|
|
389
415
|
)}
|
|
390
416
|
<StagePane
|
|
391
|
-
label={comparePane ? "Local" : undefined}
|
|
417
|
+
label={comparePane ? (surface.label ?? "Local") : undefined}
|
|
392
418
|
width={frame.width}
|
|
393
419
|
height={frame.height}
|
|
394
420
|
title={`${surface.id} preview`}
|
|
395
421
|
src={previewSrc}
|
|
422
|
+
hostState={hostState}
|
|
423
|
+
delegate={delegate}
|
|
396
424
|
reloadKey={reloadKey}
|
|
397
425
|
chrome={chrome}
|
|
398
426
|
landscape={landscape}
|
|
@@ -406,11 +434,13 @@ export const SurfaceEditor = ({
|
|
|
406
434
|
</div>
|
|
407
435
|
|
|
408
436
|
<Toolbar>
|
|
409
|
-
<ToolbarGroup label="
|
|
437
|
+
<ToolbarGroup label="Intro offer">
|
|
410
438
|
<Switch
|
|
411
|
-
label="
|
|
412
|
-
checked={
|
|
413
|
-
onChange={(checked) =>
|
|
439
|
+
label="Introductory offer"
|
|
440
|
+
checked={hasIntroductoryOffer(hostState)}
|
|
441
|
+
onChange={(checked) =>
|
|
442
|
+
setEdited((current) => ({ ...current, introductoryOfferEligible: checked }))
|
|
443
|
+
}
|
|
414
444
|
/>
|
|
415
445
|
</ToolbarGroup>
|
|
416
446
|
<ToolbarGroup label="Theme">
|
|
@@ -465,14 +495,14 @@ export const SurfaceEditor = ({
|
|
|
465
495
|
</span>
|
|
466
496
|
)}
|
|
467
497
|
</ToolbarGroup>
|
|
468
|
-
{
|
|
498
|
+
{locales.length > 1 && (
|
|
469
499
|
<ToolbarGroup label="Locale">
|
|
470
500
|
<Select
|
|
471
501
|
label="Locale"
|
|
472
502
|
value={locale ?? "default"}
|
|
473
503
|
options={[
|
|
474
504
|
{ value: "default", label: "Device" },
|
|
475
|
-
...
|
|
505
|
+
...locales.map((entry) => ({ value: entry, label: entry })),
|
|
476
506
|
]}
|
|
477
507
|
onChange={(value) => setLocale(value === "default" ? undefined : value)}
|
|
478
508
|
/>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { OpenInApp } from "../components/OpenInApp";
|
|
3
3
|
import { SurfaceCard } from "../components/SurfaceCard";
|
|
4
|
-
import { TopBar } from "../components/TopBar";
|
|
4
|
+
import { TopBar } from "../components/chrome/TopBar";
|
|
5
5
|
import { fetchStatus } from "../lib/actions";
|
|
6
|
-
import type { StudioSource, StudioStatus, StudioSurface } from "../lib/
|
|
7
|
-
import {
|
|
6
|
+
import type { StudioSource, StudioStatus, StudioSurface } from "../lib/surfaces";
|
|
7
|
+
import { hostStateFor, studioDefaults } from "../lib/host";
|
|
8
|
+
import { surfacePath } from "../lib/preview";
|
|
8
9
|
|
|
9
10
|
let lastScroll = 0;
|
|
10
11
|
|
|
@@ -18,6 +19,7 @@ export const SurfaceList = ({
|
|
|
18
19
|
device?: boolean;
|
|
19
20
|
}) => {
|
|
20
21
|
const [statuses, setStatuses] = React.useState<Record<string, StudioStatus>>({});
|
|
22
|
+
const defaults = React.useMemo(studioDefaults, [source]);
|
|
21
23
|
|
|
22
24
|
React.useEffect(() => {
|
|
23
25
|
if (source.capabilities?.actions !== true) return;
|
|
@@ -119,9 +121,17 @@ export const SurfaceList = ({
|
|
|
119
121
|
key={surfacePath(surface)}
|
|
120
122
|
surface={surface}
|
|
121
123
|
status={statuses[surfacePath(surface)]}
|
|
122
|
-
previewSrc={source.previewUrl(surface
|
|
124
|
+
previewSrc={source.previewUrl(surface)}
|
|
125
|
+
hostState={hostStateFor({
|
|
126
|
+
surface,
|
|
127
|
+
defaults,
|
|
128
|
+
sourceSamples: source.samples,
|
|
129
|
+
samples: {},
|
|
130
|
+
theme: "light",
|
|
131
|
+
edited: {},
|
|
132
|
+
})}
|
|
123
133
|
onOpen={() => onOpen(surface)}
|
|
124
|
-
href={device ?
|
|
134
|
+
href={device ? surfacePath(surface) : undefined}
|
|
125
135
|
/>
|
|
126
136
|
))}
|
|
127
137
|
</div>
|
|
@@ -147,8 +157,8 @@ export const SurfaceList = ({
|
|
|
147
157
|
|
|
148
158
|
{!device && (
|
|
149
159
|
<footer className="bg-bar flex h-11 flex-none items-center justify-center border-t border-cream/10 text-xs text-cream/55">
|
|
150
|
-
Previews run against
|
|
151
|
-
live.
|
|
160
|
+
Previews run against a real SDK host — you choose the outcomes. Edit files under
|
|
161
|
+
superwall/ and they update live.
|
|
152
162
|
</footer>
|
|
153
163
|
)}
|
|
154
164
|
</>
|
package/src/styles.css
CHANGED
|
@@ -12,28 +12,30 @@
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
@layer base {
|
|
15
|
-
|
|
15
|
+
.sw-studio {
|
|
16
16
|
color-scheme: dark;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
::selection {
|
|
19
|
+
.sw-studio ::selection {
|
|
20
20
|
background: color-mix(in srgb, var(--color-accent) 50%, transparent);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
:focus-visible {
|
|
23
|
+
.sw-studio :focus-visible {
|
|
24
24
|
outline: 2px solid var(--color-accent);
|
|
25
25
|
outline-offset: -2px;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
button {
|
|
28
|
+
.sw-studio button {
|
|
29
29
|
cursor: pointer;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
.sw-studio,
|
|
33
|
+
.sw-studio * {
|
|
33
34
|
scrollbar-width: none;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
.sw-studio::-webkit-scrollbar,
|
|
38
|
+
.sw-studio *::-webkit-scrollbar {
|
|
37
39
|
width: 0;
|
|
38
40
|
height: 0;
|
|
39
41
|
display: none;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|