@aircall/ds 0.17.1 → 0.20.0

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.
@@ -115,9 +115,8 @@ The precompiled `@aircall/ds/globals.css` contains **only the utilities DS's own
115
115
  use** — not arbitrary Tailwind classes. Any utility *your* code authors that DS doesn't
116
116
  itself ship (e.g. `px-0`, a one-off `max-w-3xl`, a custom `gap`) produces **no CSS** unless
117
117
  you run your own Tailwind build — the class sits in your JSX, the element renders unstyled,
118
- and nothing errors. A Tractor → DS migration almost always authors such classes (the
119
- `migrate-tractor/styling` recipe converts `<Flex p={2}>` / xstyled props → Tailwind
120
- utilities), so this is effectively **required**, not optional.
118
+ and nothing errors. A Tractor → DS migration almost always authors such classes, so this is
119
+ effectively **required**, not optional.
121
120
 
122
121
  Set up Tailwind v4 for *your* sources and point `@source` at your files, not at DS:
123
122
 
@@ -126,26 +125,66 @@ pnpm add -D tailwindcss @tailwindcss/postcss
126
125
  ```
127
126
 
128
127
  ```js
129
- // postcss.config.mjs (auto-detected by PostCSS bundlers: Vite, rsbuild/Rspack, Next, webpack…)
128
+ // postcss.config.mjs
130
129
  export default { plugins: { '@tailwindcss/postcss': {} } };
131
130
  ```
132
131
 
132
+ The CSS setup differs depending on whether your app is **standalone** or a
133
+ **module-federation consumer** (a remote whose host already loads DS globals).
134
+
135
+ #### Standalone app
136
+
137
+ **Using DS only:**
138
+
139
+ ```css
140
+ /* style.css */
141
+ /* Lock layer order — required. Without this, @layer base from DS globals
142
+ lands after @layer utilities and gains higher cascade priority, breaking
143
+ border, p-*, and hidden utility classes. */
144
+ @layer theme, base, components, utilities;
145
+
146
+ /* Split import: activates Tailwind for @source scanning without a second
147
+ Preflight. DS globals below owns the single base reset.
148
+ IMPORTANT: the .css extension is required — bare specifiers
149
+ (tailwindcss/theme, tailwindcss/utilities) silently produce no output
150
+ in Rsbuild/webpack PostCSS. */
151
+ @import 'tailwindcss/theme.css' layer(theme);
152
+ @import 'tailwindcss/utilities.css' layer(utilities);
153
+
154
+ @import '@aircall/ds/globals.css';
155
+
156
+ @source "./src/**/*.{ts,tsx}";
157
+ ```
158
+
159
+ **Using DS + `@aircall/blocks`:** import both — DS globals first, then blocks globals.
160
+ `@aircall/blocks/globals.css` is a delta build (blocks-specific tokens and utilities only;
161
+ no DS bundled inside), so both imports are required and there is no duplication:
162
+
163
+ ```css
164
+ /* style.css */
165
+ @layer theme, base, components, utilities;
166
+ @import 'tailwindcss/theme.css' layer(theme);
167
+ @import 'tailwindcss/utilities.css' layer(utilities);
168
+ @import '@aircall/ds/globals.css';
169
+ @import '@aircall/blocks/globals.css';
170
+ @source "./src/**/*.{ts,tsx}";
171
+ ```
172
+
173
+ #### Module-federation consumer
174
+
175
+ When your app runs as a remote inside a host that already imports DS globals (e.g.
176
+ `dashboard-v4`), **do not import DS or blocks globals** — the host's Preflight applies to the
177
+ whole document. A duplicate emitted by the remote's injected `<style>` tag wins in
178
+ `@layer base` and breaks DS component borders and padding.
179
+
133
180
  ```css
134
- /* style.css — imported once from your JS/TS entry */
135
- /* Import ONLY theme + utilities — NOT the full `@import 'tailwindcss'`, which would add a
136
- SECOND Preflight on top of the one @aircall/ds already ships (see the Common Mistake). */
137
- @import 'tailwindcss/theme';
138
- @import 'tailwindcss/utilities';
139
- @import '@aircall/ds/globals.css'; /* DS bundle: the single Preflight + tokens + DS utilities */
140
- @import '@aircall/blocks/globals.css'; /* if you use @aircall/blocks */
141
- @source "src"; /* scan YOUR code so its classes are generated */
181
+ /* style.css */
182
+ @layer theme, base, components, utilities;
183
+ @import 'tailwindcss/theme.css' layer(theme);
184
+ @import 'tailwindcss/utilities.css' layer(utilities);
185
+ @source "./**/*.{ts,tsx}";
142
186
  ```
143
187
 
144
- DS **design-token** utilities (`text-muted-foreground`, `bg-card`, …) come from the
145
- precompiled DS bundle; your build adds only the **core** utilities (`px-0`, `max-w-2xl`,
146
- layout, spacing) DS doesn't ship. Splitting into `tailwindcss/theme` + `tailwindcss/utilities`
147
- (rather than the full `tailwindcss`) is what keeps the **single** Preflight — the theme gives
148
- your utilities their scale, `@source` scans your code, and no base reset is duplicated.
149
188
 
150
189
  ### Peers you provide
151
190
 
@@ -159,13 +198,12 @@ automatically with ds; nothing to add. The only peers YOU must provide:
159
198
 
160
199
  ## Common Mistakes
161
200
 
162
- ### HIGH — Full `@import 'tailwindcss'` on top of the DS bundle (duplicated Preflight)
201
+ ### HIGH — Full `@import 'tailwindcss'` on top of the DS bundle (harmful duplicate Preflight)
163
202
 
164
- Wrong — the full import re-applies Tailwind's Preflight (base reset) on top of the one the
165
- DS bundle already ships:
203
+ Wrong — the full import re-applies Tailwind's Preflight on top of the one DS already ships:
166
204
 
167
205
  ```css
168
- @import 'tailwindcss'; /* ← also pulls in Preflight = a SECOND base reset */
206
+ @import 'tailwindcss'; /* ← pulls in Preflight = a SECOND base reset */
169
207
  @import '@aircall/ds/globals.css';
170
208
  ```
171
209
 
@@ -175,21 +213,27 @@ Correct — **not authoring your own classes:** just import the self-contained b
175
213
  import '@aircall/ds/globals.css';
176
214
  ```
177
215
 
178
- Correct — **authoring your own classes** (the migration case): import only the theme +
179
- utilities layers, never the full `tailwindcss`:
216
+ Correct — **authoring your own classes** (the migration case): split import, no full `tailwindcss`:
180
217
 
181
218
  ```css
182
- @import 'tailwindcss/theme';
183
- @import 'tailwindcss/utilities';
219
+ @layer theme, base, components, utilities;
220
+ @import 'tailwindcss/theme.css' layer(theme);
221
+ @import 'tailwindcss/utilities.css' layer(utilities);
184
222
  @import '@aircall/ds/globals.css';
185
- @source "src";
223
+ @source "./src/**/*.{ts,tsx}";
186
224
  ```
187
225
 
188
- `@aircall/ds/globals.css` is a precompiled Tailwind v4 bundle that already includes
189
- Preflight. The full `@import 'tailwindcss'` ALWAYS pulls Preflight in again — a duplicated
190
- base reset that flips `border-color` to `currentColor` (dark borders) and changes base
191
- padding/margins, breaking the DS styling in light **and** dark mode. The
192
- `theme` + `utilities` split generates your authored utilities with **no** second reset.
226
+ `@aircall/ds/globals.css` is a precompiled bundle that already includes Preflight in
227
+ `@layer base`. The full `@import 'tailwindcss'` adds a second Preflight. Which one wins
228
+ depends on load order — in module federation the remote's CSS lands after the host's, so the
229
+ remote's `border-color: currentColor` beats the DS token and card/component borders
230
+ disappear. The `theme.css` + `utilities.css` split activates Tailwind for `@source` scanning
231
+ with no Preflight emitted.
232
+
233
+ **Note on `@import 'tailwindcss/theme'` vs `@import 'tailwindcss/theme.css'`**: the bare
234
+ form (no `.css` extension) silently produces no output in Rsbuild/webpack PostCSS pipelines —
235
+ utility classes like `flex`, `gap-4`, `text-sm` are never generated. Always use the `.css`
236
+ extension.
193
237
 
194
238
  Source: aircall/hydra:docs/migration-guides/tractor-to-ds/00-setup.md (§3)
195
239