Skip to content

Commit 4efb667

Browse files
Merge pull request #4 from CaptainCodeman/update
Update
2 parents e7b0532 + fd90811 commit 4efb667

14 files changed

Lines changed: 1604 additions & 1697 deletions

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,19 @@ Import action into page and pass and object with `ondraw` and `oncomplete` metho
1212

1313
Each will receive a path which can be rendered as SVG in your component. `ondraw` fires _while the user is drawing_ and would be the current stroke. `oncomplete` fires when they have finished the line (which could transition to a different color).
1414

15+
The stroke options can be override if desired.
16+
1517
## Example
1618

1719
```svelte
1820
<script lang="ts">
1921
import { signature } from 'svelte-signature-pad'
2022
21-
let layers: { path: string; width: number; height: number }[] = []
23+
let layers: { path: string; width: number; height: number }[] = $state([])
2224
23-
let width: number
24-
let height: number
25-
let preview: string
25+
let width = $state(0)
26+
let height = $state(0)
27+
let preview = $state<string>()
2628
2729
const ondraw = (path: string) => (preview = path)
2830
const oncomplete = (path: string) => {
@@ -36,13 +38,13 @@ Each will receive a path which can be rendered as SVG in your component. `ondraw
3638
</script>
3739
3840
<div class="relative w-full h-[360px] bg-gray-100 border border-dashed border-gray-300">
39-
<div class="absolute left-4 right-4 bottom-24 border-t border-dotted border-gray-300" />
41+
<div class="absolute left-4 right-4 bottom-24 border-t border-dotted border-gray-300"></div>
4042
<div
4143
class="w-full h-full"
4244
use:signature={{ ondraw, oncomplete }}
4345
bind:clientWidth={width}
4446
bind:clientHeight={height}
45-
on:touchmove|preventDefault={() => false}
47+
ontouchmove={e => e.preventDefault()}
4648
>
4749
{#each layers as layer}
4850
<svg class="absolute w-full h-full fill-black pointer-events-none" viewBox="0 0 {layer.width} {layer.height}">
@@ -56,7 +58,7 @@ Each will receive a path which can be rendered as SVG in your component. `ondraw
5658
</svg>
5759
{/if}
5860
</div>
59-
<button class="absolute top-2 right-2 px-4 py-2 text-sm text-gray-500 bg-white border border-gray-200" on:click={clear}>Clear</button>
61+
<button class="absolute top-2 right-2 px-4 py-2 text-sm text-gray-500 bg-white border border-gray-200" onclick={clear}>Clear</button>
6062
</div>
6163
6264
<p class="mt-2 text-sm">Please sign on the dotted line to indicate that you agree to all the legal terms we all know you didn't read. Thank you!</p>

package.json

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "svelte-signature-pad",
3-
"version": "0.0.2",
3+
"version": "0.0.3",
44
"type": "module",
55
"keywords": [
66
"svelte",
@@ -23,7 +23,7 @@
2323
"homepage": "https://captaincodeman.github.io/svelte-signature-pad/",
2424
"repository": {
2525
"type": "git",
26-
"url": "https://github.com/captaincodeman/svelte-signature-pad.git"
26+
"url": "git+https://github.com/captaincodeman/svelte-signature-pad.git"
2727
},
2828
"author": {
2929
"name": "Simon Green",
@@ -41,24 +41,23 @@
4141
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
4242
},
4343
"peerDependencies": {
44-
"svelte": "^3.54.0 || ^4.0.0"
44+
"svelte": "^5.0.0"
4545
},
4646
"devDependencies": {
47-
"@sveltejs/adapter-static": "^2.0.2",
48-
"@sveltejs/kit": "^1.20.4",
49-
"autoprefixer": "^10.4.14",
50-
"postcss": "^8.4.24",
51-
"postcss-load-config": "^4.0.1",
52-
"publint": "^0.1.12",
53-
"svelte": "^4.0.0",
54-
"svelte-check": "^3.4.4",
55-
"tailwindcss": "^3.3.2",
47+
"@sveltejs/adapter-static": "^3.0.0",
48+
"@sveltejs/kit": "^2.48.7",
49+
"@sveltejs/vite-plugin-svelte": "^6.2.1",
50+
"@tailwindcss/vite": "^4.1.17",
51+
"publint": "^0.3.15",
52+
"svelte": "^5.0.0",
53+
"svelte-check": "^4.0.0",
54+
"tailwindcss": "^4.1.17",
5655
"tslib": "^2.5.3",
57-
"tsup": "^7.0.0",
58-
"typescript": "^5.1.3",
59-
"vite": "^4.3.9"
56+
"tsup": "^8.5.1",
57+
"typescript": "^5.5.0",
58+
"vite": "^7.2.4"
6059
},
6160
"dependencies": {
62-
"perfect-freehand": "^1.2.0"
61+
"perfect-freehand": "^1.2.2"
6362
}
6463
}

0 commit comments

Comments
 (0)