@saasflare/ui 3.0.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -15
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -115,7 +115,11 @@ light/dark surface variables, and motion tokens.
115
115
  > content: ["./node_modules/@saasflare/ui/dist/**/*.{js,mjs}", /* ... */]
116
116
  > ```
117
117
 
118
- ### 2. Wrap your app in `SaasflareShell` *(mandatory)*
118
+ ### 2. Make `SaasflareShell` your document root *(mandatory)*
119
+
120
+ `SaasflareShell` **is the document** — it renders `<html>` and `<body>`
121
+ itself, plus the design-system context inside. Do **not** wrap it in your
122
+ own `<html>`/`<body>` tags; replace them entirely.
119
123
 
120
124
  ```tsx
121
125
  // app/layout.tsx
@@ -125,24 +129,39 @@ import "./globals.css";
125
129
 
126
130
  export default function RootLayout({ children }: { children: React.ReactNode }) {
127
131
  return (
128
- <html lang="en" className={fontVariables} data-palette="saasflare" suppressHydrationWarning>
129
- <body>
130
- <SaasflareShell>{children}</SaasflareShell>
131
- </body>
132
- </html>
132
+ <SaasflareShell
133
+ lang="en"
134
+ palette="saasflare"
135
+ theme="dark"
136
+ className={fontVariables}
137
+ >
138
+ {children}
139
+ </SaasflareShell>
133
140
  );
134
141
  }
135
142
  ```
136
143
 
137
- > **⚠️ The wrapper is required, not optional.** `@saasflare/ui` uses
138
- > `LazyMotion features={domAnimation} strict` to keep the framer-motion bundle
139
- > tight. Animated components use the `m.*` API (e.g. `m.button`) which throws
140
- > at runtime if the `LazyMotion` provider is missing. `SaasflareShell` (or
141
- > `SaasflareProvider` directly) provides it. Without one, every `Button`,
142
- > `Card`, `Dialog`, etc. will error on mount.
143
-
144
- `SaasflareShell` also owns the theme class, smooth-scroll context, and the
145
- animation kill-switch context.
144
+ `SaasflareShell` accepts `palette`, `theme`, `surface`, `radius`,
145
+ `animated`, `smoothScrolling`, `storageKey`, plus a `lang`, `className`
146
+ (applied to `<html>`), `bodyClassName`, and a `head` slot for `<head>`
147
+ content. The chosen `palette`/`surface`/`radius`/`animated` props are
148
+ baked into the SSR HTML as `data-*` attributes, so there is **zero FOUT**
149
+ and the pre-hydration script is disabled by default.
150
+
151
+ > **⚠️ Required, not optional.** `@saasflare/ui` uses `LazyMotion
152
+ > features={domAnimation} strict` to keep the motion bundle tight.
153
+ > Animated components use the `m.*` API (e.g. `m.button`) which throws at
154
+ > runtime if `LazyMotion` is missing. `SaasflareShell` (or
155
+ > `SaasflareProvider` directly, when you need to own `<html>`/`<body>`
156
+ > yourself) provides it. Without one, every `Button`, `Card`, `Dialog`,
157
+ > etc. will error on mount.
158
+
159
+ **When to use `SaasflareProvider` instead:** if you need a runtime palette
160
+ switcher (user picks a palette via a toggle, persisted in localStorage),
161
+ keep your own `<html>`/`<body>` and wrap children in `SaasflareProvider`.
162
+ The provider's pre-hydration script reads localStorage before paint.
163
+ `SaasflareShell` is for brand-locked apps where the palette is decided at
164
+ SSR time.
146
165
 
147
166
  ### 3. Use components
148
167
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasflare/ui",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "The Next.js UI library — App Router-aware Radix primitives with Tailwind v4 and Motion, animated by default.",