diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index a4867c8..7bdb640 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -88,7 +88,7 @@ jobs:
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
# Staged, not published: nothing is public until a maintainer approves it
- # with 2FA (`npm stage approve`, see CONTRIBUTING.md). Trusted Publishing
+ # with 2FA (`pnpm stage approve`, see CONTRIBUTING.md). Trusted Publishing
# adds the provenance statement on its own.
- name: Stage via Trusted Publishing (OIDC)
run: npm stage publish *.tgz --access public --tag ${{ steps.disttag.outputs.tag }}
diff --git a/AGENTS.md b/AGENTS.md
index daf3157..18a7ab6 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -94,7 +94,7 @@ at build time too (`website/src/lib/github.ts`). Details: `website/README.md`.
A `v*` tag (pushed by `pnpm release`) runs `.github/workflows/release.yml`: CI → tag/version check →
pack + contents check → `npm stage publish` (Trusted Publishing) → draft GitHub release
-(changelogithub) → waits until a maintainer runs `npm stage approve` (2FA) → publishes the release →
+(changelogithub) → waits until a maintainer runs `pnpm stage approve` (2FA) → publishes the release →
deploys the website. Steps: `CONTRIBUTING.md` → Releases.
## Public API of the library
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7ade9af..a3d5495 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -73,17 +73,18 @@ version (`2.0.0-beta.2`…), commits it, tags it and pushes. The tag runs
`feat`, `fix` and `perf` commits, and only marks a change as breaking when its commit has a `!` or
a `BREAKING CHANGE:` footer.
-Nothing is public until a maintainer approves the staged version with 2FA (npm 11.15 or later):
+Nothing is public until a maintainer approves the staged version with 2FA, with the repo's pnpm
+(`pnpm stage`, logged in with `pnpm login`) or npm 11.15 or later (`npm stage`, same subcommands):
```sh
-npm stage list qwik-sonner
-npm stage approve # asks for the one-time password
+pnpm stage list qwik-sonner
+pnpm stage approve # asks for the one-time password
```
The workflow waits for that (up to 6 hours), then publishes the GitHub release and deploys the
website, which reads the new version from npm. If the approval takes longer, publish the draft
release by hand and run the Website workflow (Actions → Website → Run workflow). To drop a staged
-version, `npm stage reject ` and delete the draft release.
+version, `pnpm stage reject ` and delete the draft release.
Staging needs the npm Trusted Publisher of `qwik-sonner` (GitHub Actions, `release.yml`) to allow
`npm stage publish`. Keep the workflow's file name: the Trusted Publisher is tied to it.
diff --git a/website/src/lib/toaster-context.ts b/website/src/lib/toaster-context.ts
index b76eb76..e4622ba 100644
--- a/website/src/lib/toaster-context.ts
+++ b/website/src/lib/toaster-context.ts
@@ -1,9 +1,7 @@
import { createContextId, useContext, type Signal } from "@qwik.dev/core";
-import type { ToasterProps } from "qwik-sonner";
+import type { Position, Theme } from "qwik-sonner";
-// qwik-sonner doesn't export these unions yet, so derive them from the props.
-export type Position = Extract, string>;
-export type Theme = Extract, string>;
+export type { Position, Theme };
export const POSITIONS: Position[] = [
"top-left",
@@ -16,9 +14,8 @@ export const POSITIONS: Position[] = [
/**
* Live settings of the site-wide `` rendered in the root layout. Demos
- * on any page write to these signals instead of rendering their own Toaster:
- * a Toaster that is first rendered on the client (e.g. after a ``
- * navigation) never subscribes in qwik-sonner 2.0.0-beta.1.
+ * on any page write to these signals instead of rendering their own Toaster,
+ * so every toast on the site comes from the same one.
*/
export interface ToasterControls {
position: Signal;
diff --git a/website/src/routes/docs/v2/advanced/index.tsx b/website/src/routes/docs/v2/advanced/index.tsx
index c905d3f..873da09 100644
--- a/website/src/routes/docs/v2/advanced/index.tsx
+++ b/website/src/routes/docs/v2/advanced/index.tsx
@@ -45,12 +45,15 @@ const typesCode = `import type {
ToastClassnames,
ToastToDismiss,
Action,
-} from "qwik-sonner";
-
-// Not exported yet — derive them from ToasterProps:
-type Position = Extract;
-type Theme = Extract;
-type Direction = Extract;`;
+ Position, // "top-left" | "top-center" | … | "bottom-right"
+ Theme, // "light" | "dark" | "system"
+ Direction, // "rtl" | "ltr" | "auto"
+ SwipeDirection, // "top" | "right" | "bottom" | "left"
+ ToastTypes,
+ ToastIcons,
+ Offset,
+ PromiseData,
+} from "qwik-sonner"; // the same from "qwik-sonner/headless"`;
export default component$(() => {
return (
@@ -65,7 +68,10 @@ export default component$(() => {
toast() writes to a small module-level store, the same design as sonner. Each{" "}
{""} subscribes to it in the browser once Qwik starts (on the{" "}
qinit event), so the Toaster's code only loads when the page boots — not when
- it scrolls into view — and toasts work even if it sits below the fold.
+ it scrolls into view — and toasts work even if it sits below the fold. A Toaster first
+ rendered in the browser (behind a condition, or after a {""} navigation)
+ subscribes as soon as it renders, picks up the toasts already showing, and unsubscribes when
+ it unmounts.
Toasts only exist in the browser. Server-side rendering always outputs an empty toaster.
@@ -89,6 +95,14 @@ export default component$(() => {
Off by default, for parity with sonner.
No-op in browsers without the Popover API — it falls back to normal stacking.
+
+ Each Toaster opens only while it has toasts of its own, so several can use{" "}
+ topLayer.
+
+
+ The browser stacks the top layer in opening order: if a modal opens while toasts are
+ showing, the Toaster's next toast brings it back above the modal.
+
With the headless entry, add the{" "}
popover reset yourself.
@@ -100,8 +114,9 @@ export default component$(() => {
useSonner()
- A reactive list of the active toasts, for building your own renderer, a badge, or a log. It
- subscribes when the component becomes visible.
+ A reactive list of the active toasts, for building your own renderer, a badge, or a log.
+ Like the Toaster, it subscribes once the page boots (or as soon as it renders in the
+ browser) and unsubscribes when the component unmounts.
- Found in 2.0.0-beta.1. Each has a workaround; follow the{" "}
- changelog for fixes.
+ The issues found in 2.0.0-beta.1 are fixed in 2.0.0-beta.2 — see the{" "}
+ changelog. One remains, in development only:
-
-
- The subscription relies on qinit, which fires once when the page boots. A
- Toaster that mounts later — behind a condition, or on a page reached through{" "}
- {""} — misses it. Render the Toaster in the root layout.
-
-
-
-
- Same cause: useSonner() subscribes on qvisible, which a
- component mounted after boot (e.g. on a page reached through {""})
- doesn't receive, so its list stays empty until a full page load.
-
-
-
-
- The browser stacks top-layer elements in the order they open, so a Toaster whose popover
- is already open when a {" opens stays beneath it and toasts fired
- from the dialog are hidden. In 2.0.0-beta.1 a topLayer Toaster also opens its
- popover for toasts meant for other Toasters and, since it never renders them, never closes
- it again. Use topLayer only with a single Toaster, and open modals while no
- toasts are showing.
-
-
-
-
- A Toaster that started with theme="system" keeps listening to OS changes
- after its theme signal moves to light/dark (inherited from
- sonner). If you switch themes at runtime, start from an explicit theme.
-
-
-
+
- Position, Theme and Direction must be derived from{" "}
- ToasterProps for now — see TypeScript.
+ With Qwik 2.0.0-beta.37's dev server, a plain toast() followed right away by
+ a typed one (toast.success()…), before the first has rendered, can stall the
+ Toaster until the page reloads. Production builds aren't affected.