@brdgapp/ui 1.1.0 → 1.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  Every release of `@brdgapp/ui`. Versions follow the rules in README.md → Versions.
4
4
 
5
+ ## 1.1.1
6
+
7
+ 2026-11-06. A fix that changes nothing an app relies on.
8
+
9
+ - `<Toaster />` warns in the browser console, once and only in development, when the app hasn't loaded Mulish
10
+ (`lib/font-check`). The README makes loading Mulish a required setup step.
11
+
5
12
  ## 1.1.0
6
13
 
7
14
  2026-11-06. Changes from reviewing every component's handbook page. Nothing is renamed or removed, so apps on
package/README.md CHANGED
@@ -7,7 +7,7 @@ Bridge's shared components, tokens and styles. How and when to use each part is
7
7
 
8
8
  - React 19
9
9
  - Tailwind CSS 4 (apps still on Tailwind 3 upgrade first)
10
- - The Mulish font, loaded by the app
10
+ - The Mulish font, loaded by the app. Every Bridge app uses Mulish, and only Mulish (rule "One typeface").
11
11
 
12
12
  ## Set up
13
13
 
@@ -25,13 +25,24 @@ In the app's main CSS file, after Tailwind:
25
25
  That brings every token (light and dark), the base styles, and tells Tailwind to read the package's
26
26
  files, so its classes are included.
27
27
 
28
- Load Mulish however the app loads fonts. With `next/font`, name the variable `--font-mulish`:
28
+ **Then load Mulish. This step is required.** The base styles ask for Mulish, but the app has to load the
29
+ font; without it, text falls back to the device's font. If the app uses another font (VAG Rounded, Inter,
30
+ Geist) or none, switch it to Mulish and remove the old one.
31
+
32
+ In Next.js, with `next/font`, name the variable `--font-mulish` and put it on `<html>`:
29
33
 
30
34
  ```ts
35
+ import { Mulish } from "next/font/google";
31
36
  const mulish = Mulish({ subsets: ["latin"], variable: "--font-mulish" });
37
+ // <html lang="en" className={mulish.variable}>
32
38
  ```
33
39
 
34
- Anything else (a Google Fonts link, a self-hosted file) works too, as long as the family is "Mulish".
40
+ In Vite or anything else: `npm install @fontsource/mulish`, then import `@fontsource/mulish/400.css`, `500.css`,
41
+ `600.css` and `700.css` once in the entry file. A Google Fonts link or a self-hosted file also works, as long
42
+ as the family is "Mulish".
43
+
44
+ If Mulish doesn't load, `<Toaster />` says so in the browser console while you develop, and the handbook's
45
+ `check_code` flags a root layout that doesn't load it.
35
46
 
36
47
  Themes follow `data-theme="light"` or `data-theme="dark"` on `<html>`, not the device setting.
37
48
 
@@ -11,7 +11,10 @@ declare const toast: {
11
11
  /** Hide one toast, or all of them. */
12
12
  close: (id?: string) => void;
13
13
  };
14
- /** Mount once in the app's root layout. Toasts last 3 seconds (errors 6); at most 3 show at once. */
14
+ /**
15
+ * Mount once in the app's root layout. Toasts last 3 seconds (errors 6); at most 3 show at once. Being in
16
+ * every app's root, it also checks in development that the app loaded Mulish (see lib/font-check).
17
+ */
15
18
  declare function Toaster({ timeout }: {
16
19
  timeout?: number;
17
20
  }): import("react").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useState } from "react";
4
+ import { checkMulishLoaded } from "@brdgapp/ui/lib/font-check";
4
5
  import { Toast as ToastPrimitive } from "@base-ui/react/toast";
5
6
  import { AlertCircle, Check } from "lucide-react";
6
7
  import { cn } from "@brdgapp/ui/lib/utils";
@@ -27,8 +28,12 @@ function ToastList() {
27
28
  twoLines ? "max-w-sm items-start rounded-xl py-2.5" : "items-center rounded-full py-2", "transition-[opacity,translate] duration-200 ease-out data-[ending-style]:duration-150 data-[starting-style]:-translate-y-2 data-[starting-style]:opacity-0 data-[ending-style]:opacity-0"), children: [_jsx("span", { className: "flex h-[1.21875rem] shrink-0 items-center", children: _jsx(Icon, { "aria-hidden": "true", className: cn("size-4", t.type === "error" ? "text-[var(--danger-text)]" : "text-[var(--success)]") }) }), _jsxs("span", { className: "min-w-0", children: [_jsx(ToastPrimitive.Title, { render: _jsx("p", {}), className: "text-13 leading-normal font-semibold text-[var(--text-primary)]" }), twoLines ? _jsx(ToastPrimitive.Description, { render: _jsx("p", {}), className: "text-12 leading-normal text-[var(--text-muted)]" }) : null] })] }, t.id));
28
29
  });
29
30
  }
30
- /** Mount once in the app's root layout. Toasts last 3 seconds (errors 6); at most 3 show at once. */
31
+ /**
32
+ * Mount once in the app's root layout. Toasts last 3 seconds (errors 6); at most 3 show at once. Being in
33
+ * every app's root, it also checks in development that the app loaded Mulish (see lib/font-check).
34
+ */
31
35
  function Toaster({ timeout = 3000 }) {
36
+ useEffect(checkMulishLoaded, []);
32
37
  return (_jsx(ToastPrimitive.Provider, { toastManager: manager, timeout: timeout, limit: 3, children: _jsx(ToastPrimitive.Portal, { children: _jsx(ToastPrimitive.Viewport, { "data-slot": "toaster", className: VIEWPORT, children: _jsx(ToastList, {}) }) }) }));
33
38
  }
34
39
  /**
@@ -0,0 +1,3 @@
1
+ /** Warns in the console, once and only in development, when no Mulish font has loaded. */
2
+ declare function checkMulishLoaded(): void;
3
+ export { checkMulishLoaded };
@@ -0,0 +1,31 @@
1
+ // Every Bridge app sets its text in Mulish (rule "One typeface", 2026-11-06). The package's base styles ask
2
+ // for Mulish, but the app has to load the font file; without it, text quietly falls back to the device's
3
+ // font. So in development, once the page's fonts have settled, this checks that a Mulish face actually
4
+ // loaded and says how to fix it if not. Agents testing an app in a browser read the console too.
5
+ // It never runs in production, and never twice. Any way of loading works: next/font (its faces are named
6
+ // "__Mulish_…"), Fontsource, a Google Fonts link or a self-hosted file.
7
+ let checked = false;
8
+ function isDevelopment() {
9
+ // Bundlers (Next, Vite) replace `process.env.NODE_ENV`; where nothing does, `process` may not exist.
10
+ try {
11
+ return process.env.NODE_ENV !== "production";
12
+ }
13
+ catch {
14
+ return false;
15
+ }
16
+ }
17
+ /** Warns in the console, once and only in development, when no Mulish font has loaded. */
18
+ function checkMulishLoaded() {
19
+ if (checked || typeof document === "undefined" || !document.fonts || !isDevelopment())
20
+ return;
21
+ checked = true;
22
+ void document.fonts.ready.then(() => {
23
+ const loaded = Array.from(document.fonts).some((face) => /mulish/i.test(face.family) && face.status === "loaded");
24
+ if (loaded)
25
+ return;
26
+ console.warn("@brdgapp/ui: Mulish isn't loaded, so text is falling back to the device's font. Every Bridge app uses Mulish. " +
27
+ 'Load it once in the root layout: next/font (Mulish with variable "--font-mulish") or @fontsource/mulish (400, 500, 600, 700). ' +
28
+ "Setup: https://handbook.brdg.app/migrating#install");
29
+ });
30
+ }
31
+ export { checkMulishLoaded };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brdgapp/ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Bridge's shared components, tokens and styles. Documented at handbook.brdg.app.",
5
5
  "license": "UNLICENSED",
6
6
  "homepage": "https://handbook.brdg.app",