Skip to content

Commit f806f48

Browse files
committed
feat(core): bundle fontsource fonts into default styles import
Merge font loading into globals.css so ThemeSwitcher font switching works out of the box without extra imports. Browsers only download @font-face resources when the font-family is actually applied to rendered text, so bundling both Geist and Inter does not add network overhead for unused fonts. - Import fontsource via src/assets/fonts.css (separation of concerns) - globals.css imports fonts.css alongside theme.css - Remove ./styles/fonts subpath export (no longer needed) - Remove @tailor-platform/app-shell/styles/fonts from examples - Add changeset
1 parent 8ce23bb commit f806f48

6 files changed

Lines changed: 20 additions & 13 deletions

File tree

.changeset/bright-fonts-land.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@tailor-platform/app-shell": minor
3+
---
4+
5+
### Multi-theme appearance system
6+
7+
Add `ThemeSwitcher` component and font axis.
8+
9+
- New color palettes: `cream` and `bloom` alongside existing `light`/`dark`, plus a `system` option that follows OS preference
10+
- Independent font axis (`geist` / `inter`) switchable at runtime via `useFont()` hook
11+
- `ThemeSwitcher` dropdown component replaces the old light/dark toggle in `SidebarLayout`
12+
- New `defaultTheme` and `defaultFont` props on `<AppShell>`
13+
- Variable fonts (Geist and Inter) are bundled via fontsource and included in the default `styles` import

examples/nextjs-app/src/app/globals.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@import "tailwindcss";
22
@import "tw-animate-css";
33
@import "@tailor-platform/app-shell/styles";
4-
@import "@tailor-platform/app-shell/styles/fonts";
54

65
@custom-variant dark (&:is(.dark *));
76

examples/vite-app/src/index.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@import "tailwindcss";
22
@import "@tailor-platform/app-shell/styles";
3-
@import "@tailor-platform/app-shell/styles/fonts";
43

54
html,
65
body {

packages/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"type": "module",
2929
"exports": {
3030
"./styles": "./dist/app-shell.css",
31-
"./styles/fonts": "./dist/fonts.css",
3231
"./theme.css": "./dist/theme.css",
3332
".": {
3433
"types": "./dist/app-shell.d.ts",

packages/core/src/assets/fonts.css

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
/*
2-
* Self-hosted variable fonts used by AppShell's appearance axis. Shipped as a
3-
* separate, opt-in stylesheet via the `@tailor-platform/app-shell/styles/fonts`
4-
* subpath so the default `@import "@tailor-platform/app-shell/styles"` stays
5-
* font-free and consumers can choose their own loading strategy (e.g.
6-
* `next/font/local`, `next/font/google`, or a CDN).
2+
* Self-hosted variable fonts used by AppShell's appearance axis.
73
*
84
* Family names: `"Geist Variable"`, `"Inter Variable"`. AppShell's
95
* `globals.css` falls back to `"Geist Sans"` / `"Inter"` after these so

packages/core/src/globals.css

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import "tailwindcss" prefix(astw);
22
@import "tw-animate-css";
33
@import "./assets/theme.css";
4+
@import "./assets/fonts.css";
45

56
/*
67
The default border color has changed to `currentcolor` in Tailwind CSS v4,
@@ -38,11 +39,11 @@
3839
/*
3940
* Font axis — applied independently of color theme via `data-font` on `<html>`.
4041
*
41-
* Family-name chain prefers the variable build (loaded by
42-
* `@tailor-platform/app-shell/styles/fonts`), then the conventional static family
43-
* name (`Geist Sans` / `Inter` — what `next/font/google` and most CDNs
44-
* register), then the system stack. Consumers who load their own font under
45-
* either name automatically participate; no font loads when nothing matches.
42+
* Family-name chain prefers the variable build (bundled from fontsource),
43+
* then the conventional static family name (`Geist Sans` / `Inter` — what
44+
* `next/font/google` and most CDNs register), then the system stack.
45+
* Consumers who load their own font under either name automatically
46+
* participate.
4647
*/
4748
html[data-font="geist"] body,
4849
html[data-font="geist"] :where(h1, h2, h3, h4, h5, h6) {

0 commit comments

Comments
 (0)