stepsnap 0.2.0 → 0.2.1

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 CHANGED
@@ -1,257 +1,257 @@
1
- # StepSnap
2
-
3
- **Annotated screenshot walkthrough builder & viewer for React — open-source alternative to Scribe.**
4
-
5
- Create step-by-step visual guides with annotated screenshots, smooth transitions, and auto-zoom. Works in any React app or as a standalone script on any webpage.
6
-
7
- ---
8
-
9
- ## Preview
10
-
11
- ![StepSnap demo](docs/stepsnap-demo.gif)
12
-
13
- | Builder | Viewer |
14
- |---------|--------|
15
- | ![StepSnap Builder](docs/screenshot-builder.png) | ![StepSnap Viewer](docs/screenshot-viewer.png) |
16
-
17
- ---
18
-
19
- ## Features
20
-
21
- - **Builder** — upload screenshots, click to place annotations (circle or arrow), resize, reorder steps
22
- - **Viewer** — slide-by-slide walkthrough with smooth transitions, animated annotations, progress bar
23
- - **Auto-zoom** — optionally zoom in on the annotation point when a slide appears
24
- - **Click anywhere** to advance to the next step
25
- - **Storage-agnostic** — plug in your own upload function (Vercel Blob, S3, Cloudinary…)
26
- - **Standalone embed** — use on any webpage without React via a single `<script>` tag
27
- - **Zero runtime dependencies** — only React as a peer dep
28
-
29
- ---
30
-
31
- ## Installation
32
-
33
- ```bash
34
- npm install stepsnap
35
- ```
36
-
37
- ---
38
-
39
- ## Usage
40
-
41
- ### Viewer only
42
-
43
- Display a pre-built walkthrough:
44
-
45
- ```tsx
46
- import { WalkthroughViewer } from 'stepsnap'
47
- import type { WalkthroughData } from 'stepsnap'
48
-
49
- const data: WalkthroughData = {
50
- title: 'How to create a user',
51
- steps: [
52
- {
53
- id: '1',
54
- imageUrl: 'https://example.com/step1.png',
55
- caption: 'Click on the Settings tab',
56
- annotation: {
57
- type: 'circle',
58
- x: 72.5, // % from left
59
- y: 34.0, // % from top
60
- color: '#6366f1',
61
- animated: true,
62
- size: 40,
63
- zoom: true,
64
- },
65
- },
66
- ],
67
- }
68
-
69
- export default function MyPage() {
70
- return <WalkthroughViewer data={data} accentColor="#6366f1" />
71
- }
72
- ```
73
-
74
- ### Builder + Viewer
75
-
76
- Let users create and preview walkthroughs:
77
-
78
- ```tsx
79
- import { useState } from 'react'
80
- import { WalkthroughBuilder, WalkthroughViewer } from 'stepsnap'
81
- import type { WalkthroughData, UploadFn } from 'stepsnap'
82
-
83
- // Wire up your own storage
84
- const upload: UploadFn = async (file) => {
85
- const form = new FormData()
86
- form.append('file', file)
87
- const res = await fetch('/api/upload', { method: 'POST', body: form })
88
- const { url } = await res.json()
89
- return url
90
- }
91
-
92
- export default function Editor() {
93
- const [data, setData] = useState<WalkthroughData>({ title: '', steps: [] })
94
-
95
- return (
96
- <WalkthroughBuilder
97
- data={data}
98
- onChange={setData}
99
- onUpload={upload}
100
- accentColor="#6366f1"
101
- />
102
- )
103
- }
104
- ```
105
-
106
- ---
107
-
108
- ## Standalone embed (no React required)
109
-
110
- Build the embed bundle:
111
-
112
- ```bash
113
- npm run build:embed
114
- # outputs dist-embed/stepsnap-embed.js
115
- ```
116
-
117
- Then drop it on any webpage:
118
-
119
- ```html
120
- <div id="my-guide"></div>
121
- <script src="stepsnap-embed.js"></script>
122
- <script>
123
- StepSnap.mount('#my-guide', {
124
- accentColor: '#6366f1',
125
- data: {
126
- title: 'Getting started',
127
- steps: [
128
- {
129
- id: '1',
130
- imageUrl: 'https://example.com/step1.png',
131
- caption: 'Click the Settings tab',
132
- annotation: {
133
- type: 'circle',
134
- x: 72, y: 34,
135
- color: '#6366f1',
136
- animated: true,
137
- size: 40,
138
- zoom: true
139
- }
140
- }
141
- ]
142
- }
143
- })
144
- </script>
145
- ```
146
-
147
- To unmount:
148
- ```js
149
- StepSnap.unmount('#my-guide')
150
- ```
151
-
152
- > The embed bundle includes React — no other dependencies needed. Gzip size ~176 KB.
153
-
154
- ---
155
-
156
- ## Web Component (framework-agnostic)
157
-
158
- Use `<stepsnap-viewer>` on any webpage or framework:
159
-
160
- ```html
161
- <stepsnap-viewer
162
- accent-color="#6366f1"
163
- data='{"title":"My guide","steps":[{"id":"1","imageUrl":"https://...","caption":"Step 1"}]}'
164
- ></stepsnap-viewer>
165
- <script src="stepsnap-viewer-wc.iife.js"></script>
166
- ```
167
-
168
- Build the web component bundle:
169
- ```bash
170
- npm run build:wc
171
- # outputs dist-wc/stepsnap-viewer-wc.iife.js
172
- ```
173
-
174
- ---
175
-
176
- ## API
177
-
178
- ### `<WalkthroughViewer />`
179
-
180
- | Prop | Type | Default | Description |
181
- |------|------|---------|-------------|
182
- | `data` | `WalkthroughData` | required | Walkthrough content |
183
- | `accentColor` | `string` | `#6366f1` | Theme color for badges, progress bar, buttons |
184
-
185
- ### `<WalkthroughBuilder />`
186
-
187
- | Prop | Type | Default | Description |
188
- |------|------|---------|-------------|
189
- | `data` | `WalkthroughData` | required | Current walkthrough state |
190
- | `onChange` | `(data: WalkthroughData) => void` | required | Called on every change |
191
- | `onUpload` | `(file: File) => Promise<string>` | required | Upload handler — returns image URL |
192
- | `accentColor` | `string` | `#6366f1` | Theme color |
193
-
194
- ---
195
-
196
- ## Data types
197
-
198
- ```ts
199
- interface WalkthroughData {
200
- title: string
201
- steps: Step[]
202
- }
203
-
204
- interface Step {
205
- id: string
206
- imageUrl: string
207
- caption?: string
208
- annotation?: Annotation
209
- }
210
-
211
- interface Annotation {
212
- type: 'circle' | 'arrow'
213
- x: number // % from left (0–100)
214
- y: number // % from top (0–100)
215
- color: string // CSS color
216
- animated: boolean
217
- size: number // px — diameter for circle, height for arrow
218
- zoom: boolean // auto-zoom on annotation when slide appears
219
- }
220
- ```
221
-
222
- ---
223
-
224
- ## Development
225
-
226
- ```bash
227
- git clone https://github.com/m0rnlngstar/stepsnap
228
- cd stepsnap
229
- npm install
230
- npm run dev # demo app at http://localhost:5173
231
- npm run build # build npm package → dist/
232
- npm run build:embed # build standalone bundle → dist-embed/
233
- ```
234
-
235
- ---
236
-
237
- ## Roadmap
238
-
239
- - [x] Publish to npm
240
- - [ ] Keyboard navigation (← →)
241
- - [ ] Fullscreen mode
242
- - [ ] Export walkthrough as PDF / GIF
243
- - [x] Web Component (`<stepsnap-viewer>`) for non-JS frameworks
244
-
245
- ---
246
-
247
- ## Contributing
248
-
249
- Contributions are welcome. Fork the repo, make your changes, and open a pull request — improvements get merged back into the project so everyone benefits.
250
-
251
- ---
252
-
253
- ## License
254
-
255
- [AGPL-3.0-only](./LICENSE)
256
-
257
- Free to use in your apps and websites. If you distribute or offer this software as a service, you must publish your source code under the same license.
1
+ # StepSnap
2
+
3
+ **Annotated screenshot walkthrough builder & viewer for React — open-source alternative to Scribe.**
4
+
5
+ Create step-by-step visual guides with annotated screenshots, smooth transitions, and auto-zoom. Works in any React app or as a standalone script on any webpage.
6
+
7
+ ---
8
+
9
+ ## Preview
10
+
11
+ ![StepSnap demo](docs/stepsnap-demo.gif)
12
+
13
+ | Builder | Viewer |
14
+ |---------|--------|
15
+ | ![StepSnap Builder](docs/screenshot-builder.png) | ![StepSnap Viewer](docs/screenshot-viewer.png) |
16
+
17
+ ---
18
+
19
+ ## Features
20
+
21
+ - **Builder** — upload screenshots, click to place annotations (circle or arrow), resize, reorder steps
22
+ - **Viewer** — slide-by-slide walkthrough with smooth transitions, animated annotations, progress bar
23
+ - **Auto-zoom** — optionally zoom in on the annotation point when a slide appears
24
+ - **Click anywhere** to advance to the next step
25
+ - **Storage-agnostic** — plug in your own upload function (Vercel Blob, S3, Cloudinary…)
26
+ - **Standalone embed** — use on any webpage without React via a single `<script>` tag
27
+ - **Zero runtime dependencies** — only React as a peer dep
28
+
29
+ ---
30
+
31
+ ## Installation
32
+
33
+ ```bash
34
+ npm install stepsnap
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Usage
40
+
41
+ ### Viewer only
42
+
43
+ Display a pre-built walkthrough:
44
+
45
+ ```tsx
46
+ import { WalkthroughViewer } from 'stepsnap'
47
+ import type { WalkthroughData } from 'stepsnap'
48
+
49
+ const data: WalkthroughData = {
50
+ title: 'How to create a user',
51
+ steps: [
52
+ {
53
+ id: '1',
54
+ imageUrl: 'https://example.com/step1.png',
55
+ caption: 'Click on the Settings tab',
56
+ annotation: {
57
+ type: 'circle',
58
+ x: 72.5, // % from left
59
+ y: 34.0, // % from top
60
+ color: '#6366f1',
61
+ animated: true,
62
+ size: 40,
63
+ zoom: true,
64
+ },
65
+ },
66
+ ],
67
+ }
68
+
69
+ export default function MyPage() {
70
+ return <WalkthroughViewer data={data} accentColor="#6366f1" />
71
+ }
72
+ ```
73
+
74
+ ### Builder + Viewer
75
+
76
+ Let users create and preview walkthroughs:
77
+
78
+ ```tsx
79
+ import { useState } from 'react'
80
+ import { WalkthroughBuilder, WalkthroughViewer } from 'stepsnap'
81
+ import type { WalkthroughData, UploadFn } from 'stepsnap'
82
+
83
+ // Wire up your own storage
84
+ const upload: UploadFn = async (file) => {
85
+ const form = new FormData()
86
+ form.append('file', file)
87
+ const res = await fetch('/api/upload', { method: 'POST', body: form })
88
+ const { url } = await res.json()
89
+ return url
90
+ }
91
+
92
+ export default function Editor() {
93
+ const [data, setData] = useState<WalkthroughData>({ title: '', steps: [] })
94
+
95
+ return (
96
+ <WalkthroughBuilder
97
+ data={data}
98
+ onChange={setData}
99
+ onUpload={upload}
100
+ accentColor="#6366f1"
101
+ />
102
+ )
103
+ }
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Standalone embed (no React required)
109
+
110
+ Build the embed bundle:
111
+
112
+ ```bash
113
+ npm run build:embed
114
+ # outputs dist-embed/stepsnap-embed.js
115
+ ```
116
+
117
+ Then drop it on any webpage:
118
+
119
+ ```html
120
+ <div id="my-guide"></div>
121
+ <script src="stepsnap-embed.js"></script>
122
+ <script>
123
+ StepSnap.mount('#my-guide', {
124
+ accentColor: '#6366f1',
125
+ data: {
126
+ title: 'Getting started',
127
+ steps: [
128
+ {
129
+ id: '1',
130
+ imageUrl: 'https://example.com/step1.png',
131
+ caption: 'Click the Settings tab',
132
+ annotation: {
133
+ type: 'circle',
134
+ x: 72, y: 34,
135
+ color: '#6366f1',
136
+ animated: true,
137
+ size: 40,
138
+ zoom: true
139
+ }
140
+ }
141
+ ]
142
+ }
143
+ })
144
+ </script>
145
+ ```
146
+
147
+ To unmount:
148
+ ```js
149
+ StepSnap.unmount('#my-guide')
150
+ ```
151
+
152
+ > The embed bundle includes React — no other dependencies needed. Gzip size ~176 KB.
153
+
154
+ ---
155
+
156
+ ## Web Component (framework-agnostic)
157
+
158
+ Use `<stepsnap-viewer>` on any webpage or framework:
159
+
160
+ ```html
161
+ <stepsnap-viewer
162
+ accent-color="#6366f1"
163
+ data='{"title":"My guide","steps":[{"id":"1","imageUrl":"https://...","caption":"Step 1"}]}'
164
+ ></stepsnap-viewer>
165
+ <script src="stepsnap-viewer-wc.iife.js"></script>
166
+ ```
167
+
168
+ Build the web component bundle:
169
+ ```bash
170
+ npm run build:wc
171
+ # outputs dist-wc/stepsnap-viewer-wc.iife.js
172
+ ```
173
+
174
+ ---
175
+
176
+ ## API
177
+
178
+ ### `<WalkthroughViewer />`
179
+
180
+ | Prop | Type | Default | Description |
181
+ |------|------|---------|-------------|
182
+ | `data` | `WalkthroughData` | required | Walkthrough content |
183
+ | `accentColor` | `string` | `#6366f1` | Theme color for badges, progress bar, buttons |
184
+
185
+ ### `<WalkthroughBuilder />`
186
+
187
+ | Prop | Type | Default | Description |
188
+ |------|------|---------|-------------|
189
+ | `data` | `WalkthroughData` | required | Current walkthrough state |
190
+ | `onChange` | `(data: WalkthroughData) => void` | required | Called on every change |
191
+ | `onUpload` | `(file: File) => Promise<string>` | required | Upload handler — returns image URL |
192
+ | `accentColor` | `string` | `#6366f1` | Theme color |
193
+
194
+ ---
195
+
196
+ ## Data types
197
+
198
+ ```ts
199
+ interface WalkthroughData {
200
+ title: string
201
+ steps: Step[]
202
+ }
203
+
204
+ interface Step {
205
+ id: string
206
+ imageUrl: string
207
+ caption?: string
208
+ annotation?: Annotation
209
+ }
210
+
211
+ interface Annotation {
212
+ type: 'circle' | 'arrow'
213
+ x: number // % from left (0–100)
214
+ y: number // % from top (0–100)
215
+ color: string // CSS color
216
+ animated: boolean
217
+ size: number // px — diameter for circle, height for arrow
218
+ zoom: boolean // auto-zoom on annotation when slide appears
219
+ }
220
+ ```
221
+
222
+ ---
223
+
224
+ ## Development
225
+
226
+ ```bash
227
+ git clone https://github.com/m0rnlngstar/stepsnap
228
+ cd stepsnap
229
+ npm install
230
+ npm run dev # demo app at http://localhost:5173
231
+ npm run build # build npm package → dist/
232
+ npm run build:embed # build standalone bundle → dist-embed/
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Roadmap
238
+
239
+ - [x] Publish to npm
240
+ - [ ] Keyboard navigation (← →)
241
+ - [ ] Fullscreen mode
242
+ - [ ] Export walkthrough as PDF / GIF
243
+ - [x] Web Component (`<stepsnap-viewer>`) for non-JS frameworks
244
+
245
+ ---
246
+
247
+ ## Contributing
248
+
249
+ Contributions are welcome. Fork the repo, make your changes, and open a pull request — improvements get merged back into the project so everyone benefits.
250
+
251
+ ---
252
+
253
+ ## License
254
+
255
+ [AGPL-3.0-only](./LICENSE)
256
+
257
+ Free to use in your apps and websites. If you distribute or offer this software as a service, you must publish your source code under the same license.
@@ -2,6 +2,7 @@ import type { WalkthroughData } from '../types';
2
2
  interface Props {
3
3
  data: WalkthroughData;
4
4
  accentColor?: string;
5
+ maxHeight?: number;
5
6
  }
6
- export declare function WalkthroughViewer({ data, accentColor }: Props): import("react/jsx-runtime").JSX.Element | null;
7
+ export declare function WalkthroughViewer({ data, accentColor, maxHeight }: Props): import("react/jsx-runtime").JSX.Element | null;
7
8
  export {};
@@ -1,6 +1,6 @@
1
1
  import { n as e, t } from "./chunk-efA98nb6.js";
2
2
  import { t as n } from "./typeof-C-m3jXVA.js";
3
- //#region node_modules/canvg/node_modules/core-js/internals/global-this.js
3
+ //#region node_modules/core-js/internals/global-this.js
4
4
  var r = /* @__PURE__ */ t(((e, t) => {
5
5
  var n = function(e) {
6
6
  return e && e.Math === Math && e;
@@ -1099,7 +1099,7 @@ function yt(e) {
1099
1099
  };
1100
1100
  }
1101
1101
  //#endregion
1102
- //#region node_modules/canvg/node_modules/core-js/internals/to-string.js
1102
+ //#region node_modules/core-js/internals/to-string.js
1103
1103
  var bt = /* @__PURE__ */ t(((e, t) => {
1104
1104
  var n = Fe(), r = String;
1105
1105
  t.exports = function(e) {
@@ -1622,7 +1622,7 @@ function tn(e, t, n) {
1622
1622
  }) : e[t] = n, e;
1623
1623
  }
1624
1624
  //#endregion
1625
- //#region node_modules/canvg/node_modules/core-js/internals/array-reduce.js
1625
+ //#region node_modules/core-js/internals/array-reduce.js
1626
1626
  var nn = /* @__PURE__ */ t(((e, t) => {
1627
1627
  var n = E(), r = N(), i = f(), a = ge(), o = TypeError, s = "Reduce of empty array with no initial value", c = function(e) {
1628
1628
  return function(t, c, l, u) {
@@ -17144,7 +17144,7 @@ function Js() {
17144
17144
  ignoreAnimation: !0,
17145
17145
  ignoreDimensions: !0
17146
17146
  }, d = this;
17147
- return (X.canvg ? Promise.resolve(X.canvg) : import("./index.es-dUY33K7W.js")).catch(function(e) {
17147
+ return (X.canvg ? Promise.resolve(X.canvg) : import("./index.es-RGorbUvo.js")).catch(function(e) {
17148
17148
  return Promise.reject(/* @__PURE__ */ Error("Could not load canvg: " + e));
17149
17149
  }).then(function(e) {
17150
17150
  return e.default ? e.default : e;