paraframe 0.0.0-stage → 0.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/LICENSE +21 -0
- package/README.md +228 -2
- package/dist/Canvas.svelte +701 -0
- package/dist/Canvas.svelte.d.ts +9 -0
- package/dist/Comments.svelte +48 -0
- package/dist/Comments.svelte.d.ts +13 -0
- package/dist/FrameHost.svelte +135 -0
- package/dist/FrameHost.svelte.d.ts +8 -0
- package/dist/FrameLink.svelte +17 -0
- package/dist/FrameLink.svelte.d.ts +7 -0
- package/dist/Player.svelte +371 -0
- package/dist/Player.svelte.d.ts +8 -0
- package/dist/comments.d.ts +4 -0
- package/dist/comments.js +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/internal/CanvasPreview.svelte +153 -0
- package/dist/internal/CanvasPreview.svelte.d.ts +15 -0
- package/dist/internal/Icon.svelte +44 -0
- package/dist/internal/Icon.svelte.d.ts +29 -0
- package/dist/internal/Menu.svelte +138 -0
- package/dist/internal/Menu.svelte.d.ts +15 -0
- package/dist/internal/MenuItem.svelte +40 -0
- package/dist/internal/MenuItem.svelte.d.ts +12 -0
- package/dist/internal/canvas-frame.d.ts +2 -0
- package/dist/internal/canvas-frame.js +88 -0
- package/dist/internal/canvas-load-queue.d.ts +7 -0
- package/dist/internal/canvas-load-queue.js +69 -0
- package/dist/internal/comments.d.ts +36 -0
- package/dist/internal/comments.js +14 -0
- package/dist/internal/storage.d.ts +3 -0
- package/dist/internal/storage.js +22 -0
- package/dist/messages.d.ts +26 -0
- package/dist/messages.js +27 -0
- package/dist/nav.d.ts +18 -0
- package/dist/nav.js +15 -0
- package/dist/prototype.d.ts +10 -0
- package/dist/prototype.js +78 -0
- package/dist/styles.css +2 -0
- package/dist/types.d.ts +100 -0
- package/dist/types.js +1 -0
- package/package.json +97 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Convex Works
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,229 @@
|
|
|
1
|
-
|
|
1
|
+

|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://paraframe.convex.works">Showcase</a> ·
|
|
5
|
+
<a href="docs/SETUP.md">Setup</a> ·
|
|
6
|
+
<a href="docs/COMMENTS.md">Comments</a> ·
|
|
7
|
+
<a href="docs/DEVELOPMENT.md">Development</a>
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
paraframe is a read-only viewer for UI frames, in the style of a design tool's
|
|
11
|
+
prototype preview. You write each frame as a Svelte component, and paraframe
|
|
12
|
+
lays them out on a canvas and plays them one at a time. Frames are real
|
|
13
|
+
components, so anything inside them stays interactive.
|
|
14
|
+
|
|
15
|
+
Try the showcase at <https://paraframe.convex.works>.
|
|
16
|
+
|
|
17
|
+
- **Canvas.** Every frame in sections on a board you can pan and zoom.
|
|
18
|
+
- **Player.** One frame at a time, scaled to the window; named flows give you starting points.
|
|
19
|
+
- **Real components in iframes.** Each frame renders at its own size, with its own styles, media queries and fixed elements, isolated from paraframe's chrome.
|
|
20
|
+
- **Frame links.** Links, hotspots on any element, and navigation from code.
|
|
21
|
+
- **Static previews.** Optional images at overview scale that switch to live frames as you zoom in.
|
|
22
|
+
- **Comments.** Optional pinned threads on elements inside frames, through [visual-comments](https://github.com/Convex-Works/visual-comments).
|
|
23
|
+
- **Theming.** `--pf-*` custom properties for the chrome.
|
|
24
|
+
|
|
25
|
+
Requires SvelteKit 3 and Svelte 5. The chrome ships as plain CSS, so your app
|
|
26
|
+
needs no Tailwind.
|
|
27
|
+
|
|
28
|
+
## Quickstart
|
|
29
|
+
|
|
30
|
+
In a SvelteKit app (a new one from `npx sv create --template minimal --types ts`
|
|
31
|
+
works), install paraframe and delete the template's root
|
|
32
|
+
`src/routes/+page.svelte`: the canvas takes its place at `/`.
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
npm i -D paraframe
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Define the prototype once:
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
// src/lib/prototype.ts
|
|
42
|
+
import { resolve } from '$app/paths';
|
|
43
|
+
import { definePrototype } from 'paraframe';
|
|
44
|
+
|
|
45
|
+
export const prototype = definePrototype({
|
|
46
|
+
title: 'My product',
|
|
47
|
+
size: { width: 1440, height: 900 }, // default frame size
|
|
48
|
+
sections: [
|
|
49
|
+
{
|
|
50
|
+
id: 'onboarding',
|
|
51
|
+
title: 'Onboarding',
|
|
52
|
+
frames: [{ id: 'welcome', title: 'Welcome', load: () => import('./frames/Welcome.svelte') }]
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
flows: [{ id: 'signup', title: 'Sign up', start: 'welcome' }],
|
|
56
|
+
paths: {
|
|
57
|
+
canvas: () => resolve(''),
|
|
58
|
+
play: (frame) => resolve(`play/${frame}`),
|
|
59
|
+
frame: (frame) => resolve(`frame/${frame}`)
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Each frame is an ordinary Svelte component:
|
|
65
|
+
|
|
66
|
+
```svelte
|
|
67
|
+
<!-- src/lib/frames/Welcome.svelte -->
|
|
68
|
+
<main>
|
|
69
|
+
<h1>Welcome</h1>
|
|
70
|
+
<p>Your first frame.</p>
|
|
71
|
+
</main>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then add the routes. The canvas and player share a layout that loads
|
|
75
|
+
paraframe's styles; the frame route loads your product's styles instead.
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
src/routes/
|
|
79
|
+
+layout.ts
|
|
80
|
+
(viewer)/+layout.svelte
|
|
81
|
+
(viewer)/+page.svelte
|
|
82
|
+
(viewer)/play/[frame]/+page.ts
|
|
83
|
+
(viewer)/play/[frame]/+page.svelte
|
|
84
|
+
frame/[frame]/+page.ts
|
|
85
|
+
frame/[frame]/+page.svelte
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
// src/routes/+layout.ts
|
|
90
|
+
export const prerender = true;
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
```svelte
|
|
94
|
+
<!-- src/routes/(viewer)/+layout.svelte -->
|
|
95
|
+
<script lang="ts">
|
|
96
|
+
import 'paraframe/styles.css';
|
|
97
|
+
import type { LayoutProps } from './$types';
|
|
98
|
+
|
|
99
|
+
let { children }: LayoutProps = $props();
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
{@render children()}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
```svelte
|
|
106
|
+
<!-- src/routes/(viewer)/+page.svelte -->
|
|
107
|
+
<script lang="ts">
|
|
108
|
+
import { Canvas } from 'paraframe';
|
|
109
|
+
import { prototype } from '#lib/prototype.js';
|
|
110
|
+
</script>
|
|
111
|
+
|
|
112
|
+
<Canvas {prototype} />
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// src/routes/(viewer)/play/[frame]/+page.ts
|
|
117
|
+
import { frameEntries } from 'paraframe';
|
|
118
|
+
import { prototype } from '#lib/prototype.js';
|
|
119
|
+
|
|
120
|
+
export const entries = () => frameEntries(prototype);
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
```svelte
|
|
124
|
+
<!-- src/routes/(viewer)/play/[frame]/+page.svelte -->
|
|
125
|
+
<script lang="ts">
|
|
126
|
+
import { page } from '$app/state';
|
|
127
|
+
import { Player } from 'paraframe';
|
|
128
|
+
import { prototype } from '#lib/prototype.js';
|
|
129
|
+
</script>
|
|
130
|
+
|
|
131
|
+
<Player {prototype} frameId={page.params.frame ?? ''} />
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
// src/routes/frame/[frame]/+page.ts
|
|
136
|
+
import { frameEntries, resolveFrame } from 'paraframe';
|
|
137
|
+
import { prototype } from '#lib/prototype.js';
|
|
138
|
+
import type { PageLoad } from './$types';
|
|
139
|
+
|
|
140
|
+
export const entries = () => frameEntries(prototype);
|
|
141
|
+
|
|
142
|
+
export const load: PageLoad = async ({ params }) => ({
|
|
143
|
+
resolved: await resolveFrame(prototype, params.frame)
|
|
144
|
+
});
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```svelte
|
|
148
|
+
<!-- src/routes/frame/[frame]/+page.svelte -->
|
|
149
|
+
<script lang="ts">
|
|
150
|
+
// Import your product's own CSS here, never paraframe/styles.css.
|
|
151
|
+
import { FrameHost } from 'paraframe';
|
|
152
|
+
import { prototype } from '#lib/prototype.js';
|
|
153
|
+
import type { PageProps } from './$types';
|
|
154
|
+
|
|
155
|
+
let { data }: PageProps = $props();
|
|
156
|
+
</script>
|
|
157
|
+
|
|
158
|
+
<FrameHost {prototype} resolved={data.resolved} />
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
[Setup](https://github.com/Convex-Works/paraframe/blob/main/docs/SETUP.md) covers
|
|
162
|
+
frame sizes and props, static previews and theming.
|
|
163
|
+
|
|
164
|
+
To see a complete working prototype, clone this repository and run
|
|
165
|
+
`pnpm install && pnpm showcase`.
|
|
166
|
+
|
|
167
|
+
## Linking frames
|
|
168
|
+
|
|
169
|
+
Inside a frame:
|
|
170
|
+
|
|
171
|
+
```svelte
|
|
172
|
+
<script lang="ts">
|
|
173
|
+
import { FrameLink, useFrameNav } from 'paraframe';
|
|
174
|
+
const nav = useFrameNav();
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<FrameLink to="details">Open details</FrameLink>
|
|
178
|
+
|
|
179
|
+
<!-- Any element, e.g. a table row -->
|
|
180
|
+
<tr {@attach nav.hotspot('details')}>…</tr>
|
|
181
|
+
|
|
182
|
+
<!-- From code -->
|
|
183
|
+
<button onclick={() => nav.go('details')}>Save</button>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Clicking where there is no link briefly highlights everything that is one.
|
|
187
|
+
Buttons, inputs and links never trigger this. If another element handles
|
|
188
|
+
clicks inside the frame (a selectable table row, say), add `data-pf-interactive` to it.
|
|
189
|
+
|
|
190
|
+
## Keys
|
|
191
|
+
|
|
192
|
+
| View | Keys |
|
|
193
|
+
| --- | --- |
|
|
194
|
+
| Player | ← → previous and next frame, R restart the flow (while one is playing), C comment mode, Esc close the open comment, then leave comment mode |
|
|
195
|
+
| Canvas | Scroll or drag to pan, ⌘/Ctrl + scroll to zoom, ⇧1 fit all, ⇧0 100%, F or ⇧2 center and fit the selection, ← → select previous and next frame, Enter play (when no button or link has focus), C comment mode, Esc close the open comment, then leave comment mode |
|
|
196
|
+
|
|
197
|
+
On the canvas, hover live frames to inspect tooltips and hover states, and
|
|
198
|
+
double-click a frame to play it.
|
|
199
|
+
|
|
200
|
+
## Screenshots
|
|
201
|
+
|
|
202
|
+

|
|
203
|
+
|
|
204
|
+
<table>
|
|
205
|
+
<tr>
|
|
206
|
+
<td width="50%"><img src="https://raw.githubusercontent.com/Convex-Works/paraframe/main/docs/assets/screenshots/canvas-zoom.png" alt="Zoomed in on the canvas, hovering a live frame" /><br />Zoom in and frames are live: hover states and tooltips work.</td>
|
|
207
|
+
<td width="50%"><img src="https://raw.githubusercontent.com/Convex-Works/paraframe/main/docs/assets/screenshots/player.png" alt="The player stepping through a flow" /><br />The player, partway through a flow.</td>
|
|
208
|
+
</tr>
|
|
209
|
+
<tr>
|
|
210
|
+
<td><img src="https://raw.githubusercontent.com/Convex-Works/paraframe/main/docs/assets/screenshots/comments-player.png" alt="Comment threads in the player" /><br />Comments pinned to elements, with the thread list beside the frame.</td>
|
|
211
|
+
<td><img src="https://raw.githubusercontent.com/Convex-Works/paraframe/main/docs/assets/screenshots/comments-canvas.png" alt="Comment mode on the canvas" /><br />Every thread across the prototype, from the canvas.</td>
|
|
212
|
+
</tr>
|
|
213
|
+
</table>
|
|
214
|
+
|
|
215
|
+
The screenshots show an example invoicing prototype; `pnpm showcase` runs a
|
|
216
|
+
smaller one.
|
|
217
|
+
|
|
218
|
+
## Comments
|
|
219
|
+
|
|
220
|
+
Optional. Comments come from a [visual-comments](https://github.com/Convex-Works/visual-comments) server
|
|
221
|
+
through your prototype's own server, which also signs viewers in. Install
|
|
222
|
+
`visual-comments` next to paraframe, wrap the viewer layout in `<Comments>`
|
|
223
|
+
from `paraframe/comments`, and viewers can press **C** to pin threads on
|
|
224
|
+
elements inside frames. Without it, paraframe needs nothing from
|
|
225
|
+
visual-comments. See [Comments](https://github.com/Convex-Works/paraframe/blob/main/docs/COMMENTS.md).
|
|
226
|
+
|
|
227
|
+
## License
|
|
228
|
+
|
|
229
|
+
[MIT](https://github.com/Convex-Works/paraframe/blob/main/LICENSE)
|