@superwall/studio 1.1.1 → 1.2.0
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 +44 -7
- package/dist/assets/index-CVKQ82YR.js +11 -0
- package/dist/assets/index-_HCp6gCi.css +1 -0
- package/dist/index.html +2 -2
- package/dist/lib/StudioApp.d.ts +7 -0
- package/dist/lib/components/ActionMenu.d.ts +13 -0
- package/dist/lib/components/CompareMenu.d.ts +13 -0
- package/dist/lib/components/DeviceChrome.d.ts +12 -0
- package/dist/lib/components/DeviceFrame.d.ts +18 -0
- package/dist/lib/components/MissingProducts.d.ts +8 -0
- package/dist/lib/components/OpenInApp.d.ts +5 -0
- package/dist/lib/components/PaywallToasts.d.ts +5 -0
- package/dist/lib/components/SidePanel.d.ts +6 -0
- package/dist/lib/components/StudioShell.d.ts +4 -0
- package/dist/lib/components/SurfaceCard.d.ts +9 -0
- package/dist/lib/components/Toolbar.d.ts +6 -0
- package/dist/lib/components/TopBar.d.ts +8 -0
- package/dist/lib/components/VariablesPanel.d.ts +13 -0
- package/dist/lib/components/controls.d.ts +24 -0
- package/dist/lib/components/icons.d.ts +20 -0
- package/dist/lib/icon.svg +5 -0
- package/dist/lib/index.d.ts +14 -0
- package/dist/lib/index.js +1746 -0
- package/dist/lib/lib/actions.d.ts +4 -0
- package/dist/lib/lib/devices.d.ts +26 -0
- package/dist/lib/lib/events.d.ts +27 -0
- package/dist/lib/lib/preview.d.ts +7 -0
- package/dist/lib/lib/products.d.ts +16 -0
- package/dist/lib/lib/project.d.ts +12 -0
- package/dist/lib/lib/time.d.ts +1 -0
- package/dist/lib/lib/types.d.ts +77 -0
- package/dist/lib/products.js +51 -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 +15 -4
- package/src/StudioApp.tsx +3 -2
- package/src/components/ActionMenu.tsx +1 -1
- package/src/components/CompareMenu.tsx +1 -1
- package/src/components/PaywallToasts.tsx +1 -0
- package/src/components/StudioShell.tsx +12 -0
- package/src/index.ts +9 -1
- package/src/lib/events.ts +10 -1
- package/src/lib/preview.ts +10 -0
- package/src/lib/products.ts +97 -0
- package/src/lib/types.ts +2 -0
- package/src/screens/SurfaceEditor.tsx +31 -12
- package/src/styles.css +8 -6
- package/dist/assets/index-CVKGrx00.js +0 -11
- package/dist/assets/index-D4RIpSbg.css +0 -1
package/README.md
CHANGED
|
@@ -25,8 +25,10 @@ app that is also a component library — one codebase, two hosts:
|
|
|
25
25
|
|
|
26
26
|
- **`superwall dev`** serves the BUILT app (`dist/`, assets under
|
|
27
27
|
`/__studio/`) plus the data endpoint and preview mounts — the local studio.
|
|
28
|
-
- **The hosted
|
|
29
|
-
|
|
28
|
+
- **The hosted studio** in the dashboard imports the component library
|
|
29
|
+
(`dist/lib/`, the package's `.` export, plus the compiled
|
|
30
|
+
`@superwall/studio/studio.css`) and renders `SurfaceEditor` over published
|
|
31
|
+
snapshots and platform data. See [Hosting](#hosting).
|
|
30
32
|
|
|
31
33
|
## Package layout
|
|
32
34
|
|
|
@@ -34,19 +36,22 @@ app that is also a component library — one codebase, two hosts:
|
|
|
34
36
|
packages/studio/
|
|
35
37
|
├── index.html the app shell (fonts, favicon)
|
|
36
38
|
├── vite.config.ts vite + react + tailwind; /__studio/ base for builds
|
|
39
|
+
├── vite.lib.config.ts the library build: dist/lib/index.js + studio.css
|
|
40
|
+
├── tsconfig.lib.json declarations for the library build
|
|
37
41
|
├── src/
|
|
38
42
|
│ ├── main.tsx entry: fetch /__studio/project.json → <StudioApp/>
|
|
39
43
|
│ ├── index.ts the component-library barrel a hosted studio imports
|
|
40
44
|
│ ├── StudioApp.tsx URL-driven router (list ⇄ editor)
|
|
41
45
|
│ ├── screens/ SurfaceList, SurfaceEditor
|
|
42
|
-
│ ├── components/ TopBar, Toolbar, DeviceFrame, VariablesPanel,
|
|
46
|
+
│ ├── components/ StudioShell, TopBar, Toolbar, DeviceFrame, VariablesPanel,
|
|
43
47
|
│ │ ActionMenu, CompareMenu, SidePanel, controls, icons, …
|
|
44
48
|
│ ├── lib/ project.ts (wire-format parser, untrusted JSON,
|
|
45
49
|
│ │ cast-free), preview.ts (preview URL builder),
|
|
46
50
|
│ │ devices.ts (viewport + mock-device catalog),
|
|
47
51
|
│ │ actions.ts, events.ts, time.ts, types.ts
|
|
48
52
|
│ └── styles.css tailwind @theme tokens + stateful primitives
|
|
49
|
-
└── dist/ built by the workspace postinstall
|
|
53
|
+
└── dist/ built by the workspace postinstall: the app, and
|
|
54
|
+
the library under dist/lib/
|
|
50
55
|
```
|
|
51
56
|
|
|
52
57
|
## Data seam
|
|
@@ -59,8 +64,40 @@ swaps the fetch, nothing else. `previewUrl(surface, overrides)` decides what
|
|
|
59
64
|
the preview iframes load: `/preview/<kind>/<id>` mounts locally, published
|
|
60
65
|
snapshot URLs in the dashboard. Overrides travel as query params (`theme`,
|
|
61
66
|
`locale`, `sw_device`, `sw_user`, `sw_params`, `sw_products`, `sw_trial`) —
|
|
62
|
-
the same channel published snapshots accept
|
|
63
|
-
identical in both hosts.
|
|
67
|
+
the same channel published snapshots accept once opted in with
|
|
68
|
+
`?sw_preview=1`, so preview behavior is identical in both hosts.
|
|
69
|
+
|
|
70
|
+
## Hosting
|
|
71
|
+
|
|
72
|
+
The dashboard opens a code-first paywall in this studio instead of the visual
|
|
73
|
+
editor. What the library gives a host:
|
|
74
|
+
|
|
75
|
+
- `snapshotPreviewUrl(urlOf)` — a `previewUrl` that resolves each surface to
|
|
76
|
+
its published snapshot URL, opts it into simulation (`sw_preview=1`), and
|
|
77
|
+
appends the overrides. Every built snapshot boots through the framework's
|
|
78
|
+
`PreviewHost`, which reads that channel, exposes `__swPreviewApply` for
|
|
79
|
+
instant re-application (same origin only — cross-origin frames reload), and
|
|
80
|
+
drives the studio bridge: paywall events and purchase/permission/callback
|
|
81
|
+
prompts reach the host's toasts, and a `hello` message carries the
|
|
82
|
+
paywall's locales, so `SurfaceEditor` fills its locale switcher when the
|
|
83
|
+
host passes `locales: []`.
|
|
84
|
+
- One `StudioSurface` per version, told apart by `label` (`"v12 · live"`);
|
|
85
|
+
`StudioSource.compareHint` names what the compare menu offers, and
|
|
86
|
+
`SurfaceEditor`'s `actions` slot takes the host's own controls (a version
|
|
87
|
+
switcher, say). With no `capabilities`, there is no push/promote UI.
|
|
88
|
+
- `StudioShell` (`position="absolute"` when the host owns the viewport) is
|
|
89
|
+
the ink stage every screen expects, and it carries the `sw-studio` class
|
|
90
|
+
the stylesheet scopes its base rules to.
|
|
91
|
+
- `@superwall/studio/studio.css` is compiled Tailwind v4 output including a
|
|
92
|
+
preflight. Mount it in a shadow root (or an iframe) rather than beside
|
|
93
|
+
another design system — the dashboard does exactly that, and re-registers
|
|
94
|
+
the sheet's `@property` rules at document level, where browsers expect them.
|
|
95
|
+
- `@superwall/studio/products` is the pure mapping from a dashboard product
|
|
96
|
+
(the v2 API shape) to the variables a paywall reads (`price`, `periodly`,
|
|
97
|
+
`trialPeriodDays`, …). The CLI and the hosted studio share it, so the
|
|
98
|
+
Variables panel shows the same numbers in both.
|
|
99
|
+
`@superwall/studio/styles.css` is the Tailwind source for hosts that run
|
|
100
|
+
their own v4 pipeline.
|
|
64
101
|
|
|
65
102
|
## Screens
|
|
66
103
|
|
|
@@ -104,7 +141,7 @@ bun install
|
|
|
104
141
|
bun dev # the studio alone on port 6200, proxied to a running
|
|
105
142
|
# `superwall dev` (port 6100) in any project — HMR against
|
|
106
143
|
# real paywalls
|
|
107
|
-
bun run build # dist
|
|
144
|
+
bun run build # dist/ (what `superwall dev` serves) and dist/lib/ (the library)
|
|
108
145
|
bun run test
|
|
109
146
|
bun run typecheck
|
|
110
147
|
```
|