feat: add @webnet/react and @webnet/utils packages #53

Merged
codinget merged 1 commits from feat/react-and-utils-packages into main 2026-06-28 18:20:51 +02:00
Owner

Extracts two sets of utilities from the feat/tailshare branch into their own standalone packages so other apps (and tailshare itself once these land) can consume them without depending on an app package.

@webnet/react

  • useClient() — returns true on the client, false during SSR; backed by useSyncExternalStore
  • useLocalStorage(key, defaultValue?) — cross-tab-synchronised localStorage binding; also backed by useSyncExternalStore

Peer dep: react ^19. No other dependencies.

@webnet/utils

  • download(data, name) — downloads a Uint8Array | Blob | ReadableStream via showSaveFilePicker when available, falling back to an <a> click
  • upload() — opens a file picker and returns the selected File | null
  • readBlob(blob, "text" | "bytes")FileReader wrapper with an overloaded return type
  • fmtSize(n) — formats byte counts as KiB / MiB / GiB

No dependencies; browser-only (DOM APIs).

Notes

  • Both packages follow the same build setup as @webnet/tsconnect-react (tsc, "type": "module", single . export).
  • tailshare will drop its local copies once this PR lands.
Extracts two sets of utilities from the `feat/tailshare` branch into their own standalone packages so other apps (and tailshare itself once these land) can consume them without depending on an app package. ## `@webnet/react` - `useClient()` — returns `true` on the client, `false` during SSR; backed by `useSyncExternalStore` - `useLocalStorage(key, defaultValue?)` — cross-tab-synchronised localStorage binding; also backed by `useSyncExternalStore` Peer dep: `react ^19`. No other dependencies. ## `@webnet/utils` - `download(data, name)` — downloads a `Uint8Array | Blob | ReadableStream` via `showSaveFilePicker` when available, falling back to an `<a>` click - `upload()` — opens a file picker and returns the selected `File | null` - `readBlob(blob, "text" | "bytes")` — `FileReader` wrapper with an overloaded return type - `fmtSize(n)` — formats byte counts as KiB / MiB / GiB No dependencies; browser-only (DOM APIs). ## Notes - Both packages follow the same build setup as `@webnet/tsconnect-react` (`tsc`, `"type": "module"`, single `.` export). - tailshare will drop its local copies once this PR lands.
codinget added 1 commit 2026-06-27 02:43:11 +02:00
feat: add @webnet/react and @webnet/utils packages
Checks / lint (pull_request) Successful in 2m5s
Checks / format (pull_request) Successful in 2m4s
Checks / typecheck (pull_request) Successful in 9m10s
Checks / typetest (pull_request) Successful in 10m16s
Checks / build (pull_request) Successful in 11m12s
Node Tests / node-tests (pull_request) Successful in 10m57s
Browser Tests / browser-tests (pull_request) Successful in 12m28s
Checks / format (push) Successful in 3m15s
Checks / lint (push) Successful in 3m46s
Checks / typetest (push) Successful in 9m41s
Checks / typecheck (push) Successful in 11m54s
Checks / build (push) Successful in 11m59s
Node Tests / node-tests (push) Failing after 9m54s
Browser Tests / browser-tests (push) Successful in 14m28s
5dc0478970
Extracts the useClient and useLocalStorage hooks into @webnet/react,
and the download, upload, readBlob, and fmtSize utilities into @webnet/utils,
so they can be shared by tailshare and other apps without living inside
a single app package.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
codinget added the Agentic
Agent
claude-sonnet-4-6
3
labels 2026-06-27 03:15:53 +02:00
codinget marked the pull request as ready for review 2026-06-28 18:17:50 +02:00
codinget merged commit 5dc0478970 into main 2026-06-28 18:20:51 +02:00
codinget deleted branch feat/react-and-utils-packages 2026-06-28 18:20:51 +02:00
codinget added this to the Tailshare roadmap project 2026-07-12 03:02:55 +02:00
codinget moved this to Done in Tailshare roadmap on 2026-07-12 03:04:36 +02:00
Sign in to join this conversation.