- TypeScript 100%
Susie Draw #
Susie Draw is a Val Town HTML drawing app. A user chooses or uploads a transparent guide image, traces over it, switches to a separate coloring layer, and autosaves progress into a resumable gallery.
Features #
- Single HTTP val entrypoint in
main.ts - Transparent reference image canvas
- Separate tracing and coloring canvases
- Three-way Trace, Color, and Erase tool control with brush size, color, reference opacity, clear active layer, undo/redo, and PNG export controls
- One-finger or stylus drawing with two-finger pan, pinch-to-zoom, and rotate gestures
- Browser-scoped autosave using a generated device ID
- Slide-out saved drawings gallery with thumbnails, load, delete, new drawing, save-copy, and PNG export controls
- Uploaded guide images are stored with saved progress so drafts can be restored later
Persistence Model #
Saved drawings use project-scoped Val Town std/blob storage through the
std/blob/main.ts export. Each browser gets a random deviceId stored in
localStorage, and server-side blobs are stored under:
susie-draw/users/{deviceId}/index.jsonsusie-draw/users/{deviceId}/drawings/{drawingId}.json
The gallery keeps the newest 10 drawing records. Autosave updates the currently loaded drawing, while New drawing, Save copy, changing the built-in drawing, or uploading a new guide creates a fresh save file so existing gallery entries are not overwritten.
Legacy blob migration #
migrateBlobStorage.ts copies every susie-draw/users blob from the legacy
account-global store to this val's project-scoped store and verifies each copy
with SHA-256. It is idempotent and deliberately does not delete the legacy
blobs, leaving a rollback copy.
Development #
deno check --allow-import --no-lock main.ts
Local API testing with std/blob requires Val Town credentials in the runtime environment; the full save/load flow is intended to run on Val Town.
Pointer gestures are handled by the stage element instead of individual canvases so iPadOS Safari can combine one-finger or stylus drawing with two-finger pan, zoom, and rotate without losing pointer tracking.
Val Town #
Public val: pchinjr/susie-draw
The Tangled repository is the source of truth. The workflow at
.tangled/workflows/deploy.yml checks the code and runs vt push whenever a
commit reaches main. Add a Val Town token with val read/write scope to the
Tangled repository as the VAL_TOWN_API_KEY pipeline secret.
Edits made directly in Val Town will be overwritten by the next successful Tangled deployment.