{"id":50855967,"url":"https://github.com/oscarrc/crust","last_synced_at":"2026-06-14T18:04:17.340Z","repository":{"id":362996685,"uuid":"1261575602","full_name":"oscarrc/crust","owner":"oscarrc","description":"Don't throw the crust. An opinionated, crisp, and zero-waste toast library built natively for Astro and React.","archived":false,"fork":false,"pushed_at":"2026-06-06T22:50:51.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-07T00:05:09.234Z","etag":null,"topics":["astro","astrojs","react","reactjs","toast","toast-notifications"],"latest_commit_sha":null,"homepage":"http://crust.oscarrc.me/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oscarrc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-06T21:56:37.000Z","updated_at":"2026-06-06T22:50:55.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oscarrc/crust","commit_stats":null,"previous_names":["oscarrc/crust"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/oscarrc/crust","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarrc%2Fcrust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarrc%2Fcrust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarrc%2Fcrust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarrc%2Fcrust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oscarrc","download_url":"https://codeload.github.com/oscarrc/crust/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oscarrc%2Fcrust/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34331852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["astro","astrojs","react","reactjs","toast","toast-notifications"],"created_at":"2026-06-14T18:04:14.565Z","updated_at":"2026-06-14T18:04:17.333Z","avatar_url":"https://github.com/oscarrc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍞 Crust\n\n[![npm](https://img.shields.io/npm/v/@oscarrc/crust)](https://www.npmjs.com/package/@oscarrc/crust)\n[![CI](https://github.com/oscarrc/crust/actions/workflows/ci.yml/badge.svg)](https://github.com/oscarrc/crust/actions/workflows/ci.yml)\n[![license](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)\n\nDon't throw the crust. An opinionated, crisp, and zero-waste toast library built natively for Astro and React.\n\nMost toast libraries are bloated white bread. They force you into wrapper fatigue, endless configuration files, and a hard React dependency just to slide a notification onto the screen.\n\n**Crust is different.** The renderer is vanilla DOM — a React-free Astro site is a first-class citizen, and React gets a thin, concurrent-safe bridge on top. Warm matte surfaces, a capsule that grows into a card as one continuous surface, and rock-solid defaults. Take it or leave it — just like the crust.\n\n**[Docs \u0026 playground →](https://crust.oscarrc.me)**\n\n---\n\n## Why Crust?\n\n- 🚀 **Astro-first, honestly.** The core renders with plain DOM. No React island required to *show* toasts — React is an optional peer dependency.\n- 🫙 **One shared store.** Trigger from an Astro `\u003cscript\u003e`, a React island, or anywhere else: same toaster, same stack, no provider, no context.\n- 🔥 **Crisp \u0026 opinionated.** A tactile morph-expand interaction and an organic motion profile (ease-out-quint, nothing over 320ms, zero bounce). No spending 40 minutes tweaking cubic-béziers.\n- ♿ **Accessible by default.** `aria-live` region, keyboard-reachable dismiss, timers that pause while you read, and `prefers-reduced-motion` as a first-class theme.\n- 📦 **Zero-waste footprint.** ESM-only, ~2 KB of JS, one CSS file, no dependencies.\n\n## Quickstart\n\nInstall the package:\n\n```bash\npnpm add @oscarrc/crust\n```\n\nImport the styles and mount the toaster once, at the root of your layout — no React, no provider:\n\n```ts\nimport '@oscarrc/crust/styles.css';\nimport { mountToaster } from '@oscarrc/crust/vanilla';\n\nmountToaster(); // bottom-right by default\n```\n\nThen bake toasts from anywhere:\n\n```ts\nimport { toast } from '@oscarrc/crust/vanilla';\n\ntoast.success('Fresh bread out of the oven!');\n\n// A message makes a toast expandable — it morphs open on hover/focus/tap,\n// or on its own with `expandAfter`:\ntoast('Order update', {\n  message: 'Your order shipped today.',\n  expandAfter: 2000 // auto-expands 2s after becoming visible\n});\n\n// Async flows: loading → success/error, opening the outcome by itself:\ntoast.promise(saveDraft(), {\n  loading: 'Saving…',\n  success: (draft) =\u003e ({ title: 'Saved', message: `“${draft.name}” is safe.` }),\n  error: 'Save failed'\n}, { expandOnSettle: true });\n```\n\nThat's the whole setup. For React islands, view transitions, theming, and the rest, read on — or head to the **[docs \u0026 playground](https://crust.oscarrc.me)**.\n\n## Usage\n\n### 1. Pure Astro / vanilla JS — zero React\n\n```astro\n---\n// src/layouts/Layout.astro\nimport '@oscarrc/crust/styles.css';\n---\n\u003chtml\u003e\n  \u003cbody\u003e\n    \u003cslot /\u003e\n    \u003cscript\u003e\n      import { mountToaster } from '@oscarrc/crust/vanilla';\n      mountToaster();\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n```astro\n\u003cbutton id=\"alert\"\u003eBake toast\u003c/button\u003e\n\u003cscript\u003e\n  import { toast } from '@oscarrc/crust/vanilla';\n  document.getElementById('alert')?.addEventListener('click', () =\u003e {\n    toast.success('Bakery live', { message: 'Fresh bread out of the oven!' });\n  });\n\u003c/script\u003e\n```\n\n### 2. Astro with React islands\n\nMount `\u003cToaster /\u003e` once in your shell layout. With view transitions\n(`\u003cClientRouter /\u003e`), `transition:persist` carries live toasts across page\nnavigations:\n\n```astro\n---\nimport { ClientRouter } from 'astro:transitions';\nimport { Toaster } from '@oscarrc/crust/react';\nimport '@oscarrc/crust/styles.css';\n---\n\u003chtml\u003e\n  \u003chead\u003e\u003cClientRouter /\u003e\u003c/head\u003e\n  \u003cbody\u003e\n    \u003cslot /\u003e\n    \u003cToaster client:load transition:persist /\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### 3. React (islands or plain apps)\n\n```tsx\nimport { toast } from '@oscarrc/crust/vanilla';\nimport { useToasts } from '@oscarrc/crust/react';\n\nexport function Dashboard() {\n  const active = useToasts();\n  return (\n    \u003cbutton onClick={() =\u003e toast.info('Triggered inside an island!')}\u003e\n      Active toasts ({active.length})\n    \u003c/button\u003e\n  );\n}\n```\n\n## API at a glance\n\n```ts\ntoast('title', { message, type, duration, icon });\ntoast.success('…'); toast.error('…'); toast.info('…'); toast.warning('…');\n\nconst id = toast.loading('Uploading…');          // persistent spinner\ntoast.update(id, { title: 'Done', type: 'success', duration: 4000 });\n\ntoast.promise(save(), {                           // loading → success/error\n  loading: 'Saving…',\n  success: (v) =\u003e `Saved ${v.name}`,\n  error: 'Save failed'\n});\ntoast('Hi', { message: 'Read me', expandAfter: 2000 }); // opens itself after 2s\n// toast.promise(…, { expandOnSettle: true }) opens the outcome\n\ntoast.dismiss(id);  // one\ntoast.dismiss();    // all, queue included\n\nmountToaster({ position: 'bottom-right', maxVisible: 5, icons: { … } });\n```\n\n- `duration` defaults to **4000ms**; `Infinity` (or `0`) means persistent.\n- A toast with a `message` morphs open on hover/focus/tap to reveal it; the timer pauses while you read.\n- Icons accept an SVG string, an `Element`, or a factory — [`lucide`](https://lucide.dev) and `lucide-static` work out of the box (`lucide-react` doesn't; the renderer isn't React).\n- Theme everything via `--crust-*` custom properties — see the [theming docs](https://crust.oscarrc.me/docs/theming/).\n\n## Non-goals\n\nDeliberately not in scope: JSX toast content — the renderer is vanilla DOM,\nwhich is exactly what makes the React-free story work. Opinionated means\nopinionated.\n\n## Development\n\n```bash\npnpm install     # link workspaces\npnpm build:lib   # build the package → packages/crust/dist\npnpm test        # vitest: store, renderer, react bridge\npnpm dev         # tsup --watch + astro dev (docs playground)\n```\n\nReleases are automated: conventional commits → [release-please](https://github.com/googleapis/release-please) PR → merge → npm publish with provenance.\n\n## License\n\n[MIT](./LICENSE) © Oscar Rey\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscarrc%2Fcrust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foscarrc%2Fcrust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foscarrc%2Fcrust/lists"}