@vvedantb/ui 0.10.1 → 0.11.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.
package/app/README.md DELETED
@@ -1,259 +0,0 @@
1
- # App helpers (`@vvedantb/ui`)
2
-
3
- Shared web React helpers that were duplicated across apps. Source-exported as the `./app` subpath of `@vvedantb/ui`.
4
-
5
- ## Install
6
-
7
- ```sh
8
- npm install @vvedantb/ui
9
- ```
10
-
11
- ## Peers
12
-
13
- Required: `react` and `react-dom` (>=19). Optional peers of `@vvedantb/ui` used by the app helpers: `@clerk/clerk-react` (`useStableAuth`, `ConvexClerkProvider`), `convex` (`ConvexClerkProvider`, `useEnsureUser`), `@tanstack/react-hotkeys` and `zod` (your `z` for `parseClientEnv`). The root imports Clerk and `convex/react` statically, so they must be installed even if you do not use these helpers; see the package README.
14
-
15
- `sonner` is not a dependency. The update watcher takes the toast API as an option. The app source uses a local class join, which the root does not export (the root `cn` is the clsx and tailwind-merge one). Tailwind must scan `node_modules/@vvedantb/ui/app/src/**/*.{ts,tsx}` so the class names are generated, and the app needs the `@vvedantb/ui/tokens` names (`bg-surface-card`, `divide-separator`, `text-muted-foreground` and so on).
16
-
17
- ```css
18
- @source "../node_modules/@vvedantb/ui/app/src/**/*.{ts,tsx}";
19
- ```
20
-
21
- ## Confirm skip (Alt-click)
22
-
23
- ```tsx
24
- import { ConfirmSkipHint, skipConfirmTitle, useRequestConfirm } from "@vvedantb/ui";
25
-
26
- const { request } = useRequestConfirm();
27
-
28
- <DropdownMenuItem
29
- title={skipConfirmTitle("Delete")}
30
- onSelect={(event) => request(() => setOpen(true), () => remove(), event)}
31
- >
32
- Delete <ConfirmSkipHint />
33
- </DropdownMenuItem>
34
- ```
35
-
36
- - `useRequestConfirm` does not subscribe to Alt. It reads `getAltHeld()` when the request happens, so the menu owner does not re-render when Alt goes down. It returns `{ request }` only.
37
- - `ConfirmSkipHint` stays mounted and gains a `hidden` class when Alt is not held, so an open Radix menu keeps a stable child tree.
38
- - The Alt store resets when the last subscriber leaves, clears on blur and tab hide, and cancels a bare Alt keydown only inside `[role='menu']` or `[data-radix-menu-content]`.
39
- - Also exported: `useAltHeld`, `getAltHeld`, `createAltHeldStore`, `bindToWindow`, `shouldSkipConfirm`, `requestConfirm`.
40
-
41
- ## Update available watcher
42
-
43
- ```ts
44
- import { toast } from "sonner";
45
- import { startUpdateAvailableWatcher } from "@vvedantb/ui";
46
-
47
- useEffect(
48
- () =>
49
- startUpdateAvailableWatcher({
50
- origin: window.location.origin,
51
- toast,
52
- closeConvex: () => void convex.close(),
53
- enabled: !import.meta.env.DEV,
54
- }),
55
- [],
56
- );
57
- ```
58
-
59
- Options: `origin`, `toast`, `closeConvex?`, `pollMs?` (default 60000), `toastId?` (default `app-update-available`), `enabled?` (default true), `reload?` (default `window.location.reload`). On a changed asset fingerprint it shows a sticky "Update available" toast. Refresh calls `closeConvex` (errors ignored), then reloads. `fingerprintFromHtml` and `fetchDeployFingerprint` are exported too. The fingerprint looks for Vite `/assets/*.js` URLs in the index HTML.
60
-
61
- ## Settings chrome
62
-
63
- ```tsx
64
- import { SettingsPage, SettingsSection, SettingsToggleRow } from "@vvedantb/ui";
65
-
66
- <SettingsPage
67
- title="Notifications"
68
- layout={({ title, headerRight, toolbar, tabs, fillHeight, children }) => (
69
- <PageContainer title={title} rightSection={headerRight} toolbar={toolbar} tabs={tabs} noScroll={fillHeight}>
70
- {children}
71
- </PageContainer>
72
- )}
73
- >
74
- <SettingsSection title="Email" bodyVariant="list">
75
- <SettingsToggleRow title="Weekly digest" action={<Switch />} />
76
- </SettingsSection>
77
- </SettingsPage>
78
- ```
79
-
80
- Exports: `SettingsSection`, `SettingsField`, `SettingsStack`, `SettingsToggleRow`, `SettingsEmptyState` (icon is `ComponentType<{ size?: number; className?: string }>`), `SettingsPage`. `SettingsField` `layout`: `"stacked"` (default) puts the label above the control. `"horizontal"` renders one row with the label and description on the left and the control on the right. Without `layout`, `SettingsPage` renders a plain `div` with a heading and the optional slots.
81
-
82
- ## useStableAuth
83
-
84
- ```ts
85
- import { useStableAuth } from "@vvedantb/ui"; // 2000 ms debounce, wraps Clerk useAuth
86
- import { createUseStableAuth } from "@vvedantb/ui";
87
-
88
- const useAuth = createUseStableAuth(useClerkAuth, { debounceMs: 3000 });
89
- ```
90
-
91
- After a signed-in session, a drop to signed-out reports `isLoaded: false` for the debounce window so Convex does not cascade. State is module-level. `resetStableAuthSession()` clears it and is for tests only.
92
-
93
- ## Develop
94
-
95
- ```sh
96
- pnpm --filter @vvedantb/ui typecheck
97
- pnpm --filter @vvedantb/ui test
98
- ```
99
-
100
- Source is in `app/src` and tests in `app/tests`. Publish steps are in the root `README.md`.
101
-
102
- ## Theme
103
-
104
- ```tsx
105
- import { createThemeProvider } from "@vvedantb/ui";
106
-
107
- // One kit per app, at module level.
108
- export const { ThemeProvider, useTheme } = createThemeProvider();
109
-
110
- <ThemeProvider attribute="class" defaultTheme="system" enableSystem disableTransitionOnChange>
111
- <App />
112
- </ThemeProvider>;
113
-
114
- const { theme, resolvedTheme, setTheme, isDark, toggleTheme, mounted } = useTheme();
115
- ```
116
-
117
- `createThemeProvider` is a port of next-themes 0.4.6. An app that uses next-themes can switch without a change in behaviour: the same localStorage writes, `<html>` classes and attributes, `style.colorScheme`, `prefers-color-scheme` listener, cross-tab `storage` sync and transition blocking. Parity tests run both side by side.
118
-
119
- - Props, as in next-themes: `storageKey` (`"theme"`), `defaultTheme` (`"system"` with `enableSystem`, else `"light"`), `enableSystem` (`true`), `enableColorScheme` (`true`), `attribute` (`"data-theme"`; `"class"`, any `data-*`, or an array), `themes` (`["light", "dark"]`), `value` (theme name to written value), `forcedTheme`, `disableTransitionOnChange` (`false`) and `nonce`.
120
- - State: `theme`, `setTheme` (a value or a function of the current theme), `resolvedTheme`, `systemTheme`, `forcedTheme` and `themes`, as in next-themes. Added: `mounted` (after the provider's first effect), `isDark` (`mounted && resolvedTheme === "dark"`) and `toggleTheme` (from `resolvedTheme`).
121
- - `setTheme` is a new function each time `theme` changes and stable otherwise, as in next-themes, so effects that list it re-run at the same times.
122
- - next-themes reads the DOM options (`attribute`, `themes`, `value`, `enableSystem`, `enableColorScheme`, `defaultTheme`, `disableTransitionOnChange`, `nonce`) once, on the first render, and so does this port. If `enableSystem` starts `false` and later turns `true`, a stored `"system"` is written as the class `system`. `forcedTheme` follows props.
123
- - A nested `ThemeProvider` from the same kit renders only its children.
124
- - `createThemeProvider({ missingProviderMessage })`: `useTheme()` outside the provider throws that message. Without it, `useTheme()` returns an empty state with no-op setters, as next-themes does.
125
- - No inline script is rendered. next-themes renders one for server rendering; React does not run it in a client-rendered app. Keep a pre-paint script in `index.html` if the app has one.
126
-
127
- For an app with its own theme state (for example a theme synced from the server), two helpers:
128
-
129
- - `getSystemTheme()`: `"dark"` or `"light"` from `prefers-color-scheme`; `"light"` without `window`.
130
- - `applyThemeClass(theme)`: removes `light` and `dark` from `<html>`, then adds `theme`. No-op without `document`.
131
-
132
- ## Page title
133
-
134
- ```tsx
135
- import { createPageTitleContext } from "@vvedantb/ui";
136
-
137
- export const { PageTitleProvider, usePageTitle, usePageTitleSync } = createPageTitleContext({
138
- missingProviderMessage: "usePageTitle must be used within a PageTitleProvider",
139
- });
140
-
141
- // The shell reads it:
142
- const { pageTitle } = usePageTitle();
143
- // A page publishes it while mounted:
144
- usePageTitleSync(title);
145
- ```
146
-
147
- - `usePageTitle()` returns `{ pageTitle, setPageTitle, mobileActionsSlot, setMobileActionsSlot }`. `mobileActionsSlot` is an element a mobile top bar registers (pass `setMobileActionsSlot` as its `ref`) so pages can portal actions into it.
148
- - `usePageTitleSync(title)` sets the title while the caller is mounted and clears it on unmount. Titles that are not strings publish `""`.
149
- - `missingProviderMessage`: `usePageTitle()` outside the provider throws it. Without it, `usePageTitle()` returns an empty title and no-op setters.
150
- - `documentTitle` (off by default; without it `document.title` is never touched): `{ suffix?, separator? = " · ", fallback? }`. While a page title is set, `document.title` is `` `${pageTitle}${separator}${suffix}` `` (just the page title without a suffix). While it is empty, `fallback`, else the title at mount. The mount-time title comes back on unmount.
151
-
152
- ## Page motion
153
-
154
- ```tsx
155
- import { MotionConfig } from "motion/react";
156
- import { PageMotionProvider, useDisablePageMotion } from "@vvedantb/ui";
157
-
158
- <PageMotionProvider disabled={flags?.disablePageMotion === true} motionConfig={MotionConfig}>
159
- <App />
160
- </PageMotionProvider>;
161
- ```
162
-
163
- - Sets `html[data-page-motion]` to `"off"` or `"on"` in a layout effect (CSS can skip page and route transitions on `"off"`). The attribute stays after unmount.
164
- - Renders `motionConfig` with `reducedMotion` `"always"` when disabled, else `"never"`.
165
- - `useDisablePageMotion()`: the `disabled` value, `false` outside the provider.
166
- - This module does not import `motion`. Pass `MotionConfig`, or an app component that wraps it, defined at module level, for example with `LazyMotion`:
167
-
168
- ```tsx
169
- function LazyMotionConfig({ reducedMotion, children }: PageMotionConfigProps) {
170
- return (
171
- <LazyMotion features={domAnimation}>
172
- <MotionConfig reducedMotion={reducedMotion}>{children}</MotionConfig>
173
- </LazyMotion>
174
- );
175
- }
176
- ```
177
-
178
- ## Compact relative time
179
-
180
- ```ts
181
- import { formatCompactRelativeTime } from "@vvedantb/ui";
182
-
183
- formatCompactRelativeTime(createdAt, { justNow: "now" }); // "now", "5m", "3h", "2d", "4mo", "1y"
184
- formatCompactRelativeTime(updatedAt, { calendar: true }); // "42s", ..., calendar months and years
185
- ```
186
-
187
- Pure TypeScript, no dependencies. Options:
188
-
189
- - `now`: clock in ms, default `Date.now()`.
190
- - `justNow`: returned for anything under a minute old, future times included. Without it the result is whole seconds (`"42s"`), and a future time gives `"0s"` or a negative count.
191
- - `calendar`: `false` (default) counts elapsed time: a day is 24 hours, a month 30 days, a year 12 such months. `true` counts as `dayjs().diff(date, unit)` does: days by the local calendar across DST changes, and calendar months and years.
192
-
193
- Strings are parsed with `new Date(string)`. dayjs parses a date-only string such as `"2026-03-01"` as local midnight, `new Date` as UTC midnight; numbers, `Date` objects and ISO strings with a time give the same result either way. An invalid date gives `"NaNy"` (`"0mo"` with `calendar`).
194
-
195
- ## Convex provider, VITE env and ensure-user (0.10.0)
196
-
197
- React and VITE env helpers for Convex apps. The non-React Convex helpers (`mapLoadedQuery`, `forEachLoadedQuery`, `updateAllCachedQueries`, `patchLoadedQuery`, `OptimisticStore`, `tempId`, `createMemoryOptimisticStore`) live in `@vvedantb/server`, so backend packages, tests and React Native can use them without loading this package.
198
-
199
- ### `ConvexClerkProvider`
200
-
201
- ```tsx
202
- import { ConvexClerkProvider, useStableAuth } from "@vvedantb/ui";
203
- import { ConvexReactClient } from "convex/react";
204
-
205
- const convex = new ConvexReactClient(env.VITE_CONVEX_URL);
206
-
207
- <ClerkProvider publishableKey={env.VITE_CLERK_PUBLISHABLE_KEY}>
208
- <ConvexClerkProvider client={convex} useAuth={useStableAuth}>
209
- <App />
210
- </ConvexClerkProvider>
211
- </ClerkProvider>;
212
- ```
213
-
214
- | Props | Renders |
215
- | --- | --- |
216
- | `client` is `null` or `undefined` | `children` alone (no provider). |
217
- | `clerk={false}` | `<ConvexProvider client={client}>`. |
218
- | otherwise | `<ConvexProviderWithClerk client={client} useAuth={useAuth}>`; `useAuth` defaults to `@clerk/clerk-react`'s. |
219
-
220
- `clerk` defaults to `true`. Render it inside `ClerkProvider` unless `clerk` is `false`. Types: `ConvexClerkProviderProps`, `ConvexClerkUseAuth`.
221
-
222
- ### `parseClientEnv`
223
-
224
- ```ts
225
- import { z } from "zod";
226
- import { parseClientEnv } from "@vvedantb/ui";
227
-
228
- export const clientEnv = parseClientEnv(import.meta.env, { z, viteEnv: "fallback" });
229
- // { VITE_CONVEX_URL: string; VITE_CLERK_PUBLISHABLE_KEY: string; VITE_ENV: "development" | "staging" | "production" }
230
-
231
- export const extensionEnv = parseClientEnv(import.meta.env, {
232
- z,
233
- viteEnv: false,
234
- extend: { VITE_CLERK_SYNC_HOST: z.string().url() },
235
- });
236
- ```
237
-
238
- The schema is `z.object({ VITE_CONVEX_URL: z.string().min(1), VITE_CLERK_PUBLISHABLE_KEY: z.string().min(1), VITE_ENV: z.enum(["development", "staging", "production"]), ...extend })`, built with your `z` (zod 3.25+ or 4; the package never imports zod at runtime). Only the schema's keys are read from `rawEnv`. Failure throws the `ZodError` from `.parse`.
239
-
240
- | `viteEnv` | `VITE_ENV` |
241
- | --- | --- |
242
- | `"strict"` (default) | Must be one of `VITE_ENV_NAMES`. |
243
- | `"fallback"` | Any other value, or none, becomes `"development"` before parsing. |
244
- | `false` | Not in the schema or the result. |
245
-
246
- Types: `ClientEnv`, `ClientEnvWithoutViteEnv`, `ClientEnvOptions`, `ClientEnvSource`, `ViteEnvMode`, `ViteEnvName`.
247
-
248
- ### `useEnsureUser`
249
-
250
- ```tsx
251
- function EnsureUser() {
252
- useEnsureUser(api.users.ensureUserExists);
253
- return null;
254
- }
255
- ```
256
-
257
- Calls `mutation({})` every time `useConvexAuth().isAuthenticated` becomes `true` (once on mount if already signed in), and logs a rejection with `console.error`. Needs a Convex auth provider above it (`ConvexClerkProvider` with Clerk on). Pair it with `ensureUser` from `@vvedantb/server`. Type: `EnsureUserMutation`.
258
-
259
- Tests: `app/tests/convex/` ports each app's copy and runs it beside the helper (env with zod 4 and zod 3.25; provider variants; ensure-user calls over auth sequences). `app/tests-node/convex-esm.test.mjs` loads the helpers in plain Node.
package/tokens/README.md DELETED
@@ -1,98 +0,0 @@
1
- # `@vvedantb/ui/tokens`
2
-
3
- Design tokens and shared Tailwind v4 CSS for the vvedantb web apps. The CSS and Tailwind preset are subpaths of `@vvedantb/ui`; the native JS tokens are named exports of the root (`tokens`, `Tokens`). Source-exported: no build step. Paths in the `File` column are relative to `packages/ui/tokens/`.
4
-
5
- ## Exports
6
-
7
- | Export | File | What it is |
8
- | --- | --- | --- |
9
- | `@vvedantb/ui/tokens`, `@vvedantb/ui/tokens/tokens.css` | `src/tokens.css` | Colour, radius, shadow, ease and font tokens (`@theme`), light/dark variables, `dark` variant, the radius utilities `rounded-surface` (`clamp(0.75rem, var(--radius), 1rem)`), `rounded-menu-item` (`min(var(--radius), 0.5rem)`) and `rounded-control` (`min(var(--radius), 0.625rem)`) (0.7.1; `rounded-surface` was in `utilities.css` before), `*` border and `body` defaults. 0.7.2 adds `--sidebar-accent` / `sidebar-accent` (sidebar nav row fill: light `var(--surface-tertiary)`, dark `oklch(22.64% 0 0)`). In 0.2.1 it also defines shadcn-style aliases (`primary`, `muted-foreground`, `secondary`, `destructive`, `card`, `popover`, `input`, `ring`) that point at the same tokens. |
10
- | `tokens` and `Tokens` from `@vvedantb/ui` | `src/native.ts` | JS colours, radii and spacing for React Native. `@vvedantb/native-ui` keeps its own copy in `src/tokens.ts`; a test keeps the two equal. |
11
- | `@vvedantb/ui/tokens/css/base.css` | `src/css/base.css` | `html` touch/accent, `::selection`, control transitions, pointer cursor, range accent (`@layer base`). |
12
- | `@vvedantb/ui/tokens/css/dialog.css` | `src/css/dialog.css` | Unlayered `max-width: none` for `@vvedantb/ui` compact (bottom-sheet) dialogs. |
13
- | `@vvedantb/ui/tokens/css/modal.css` | `src/css/modal.css` | `.t-modal`, `.is-open`, `.is-closing` and `t-modal-presence-wait` (`@layer components`). |
14
- | `@vvedantb/ui/tokens/css/tabs.css` | `src/css/tabs.css` | `.t-tab`, active colour, `.t-tabs-pill`, small-screen `.t-tabs` scrolling. |
15
- | `@vvedantb/ui/tokens/css/tabs-pills.css` | `src/css/tabs-pills.css` | `--tabs-*` colour variables, `.t-tabs--segmented`, `.t-tabs--pills` and pill hover / active fills. |
16
- | `@vvedantb/ui/tokens/css/utilities.css` | `src/css/utilities.css` | `@utility hit-target` and `@utility reveal-on-hover`. `rounded-surface` moved to `tokens.css` in 0.7.1. |
17
- | `@vvedantb/ui/tokens/css/scrollbar-thin.css` | `src/css/scrollbar-thin.css` | `.scrollbar-thin` (`@layer utilities`, always emitted). |
18
- | `@vvedantb/ui/tokens/css/animations.css` | `src/css/animations.css` | `animate-aurora`, `animate-fade-in-up`, `animate-indeterminate` as `@theme` (CSS-first apps). |
19
- | `@vvedantb/ui/tokens/css/compat-shadcn-rgb.css`, `@vvedantb/ui/tokens/compat/shadcn-rgb.css` | `src/css/compat-shadcn-rgb.css` | Replaces `tokens.css` for apps with shadcn-style `R G B` channel variables. Defines only the UI-only `--color-*` names as `rgb(var(--x) / alpha)` references, `--radius-field`, `--scrollbar`, `--field-radius`, the same three radius utilities as `tokens.css` and a `glass-panel-strong` fallback. Import it **or** `tokens.css`, never both. |
20
- | `@vvedantb/ui/tokens/css/index.css` | `src/css/index.css` | base + dialog + utilities + scrollbar-thin + animations, for new CSS-first apps. |
21
- | `@vvedantb/ui/tokens/tailwind-preset` | `src/tailwind-preset.mjs` (+ `.d.mts`) | Tailwind preset for apps that load a JS config with `@config`. |
22
-
23
- Every file was extracted because the same rule (same at-rule context, selector and body) sits in 3 or more of the five apps. The measured duplication is in `verify/ANALYSIS.md`, and the proof that each app compiles to the same CSS after migrating is in `verify/RESULTS.md`. Blocks that only 2 apps share, or that drift in a way that would change an app's CSS, stay in the apps; `verify/ANALYSIS.md` lists them.
24
-
25
- ## Use
26
-
27
- CSS-first app (no `tailwind.config`):
28
-
29
- ```css
30
- @import "tailwindcss";
31
- @import "@vvedantb/ui/tokens";
32
- @import "@vvedantb/ui/tokens/css/animations.css";
33
- @import "@vvedantb/ui/tokens/css/base.css";
34
- /* ...app @layer base rules... */
35
- @import "@vvedantb/ui/tokens/css/modal.css";
36
- @import "@vvedantb/ui/tokens/css/tabs.css";
37
- /* ...app @layer components rules... */
38
- ```
39
-
40
- App with a JS config (`@config "../tailwind.config.ts"`):
41
-
42
- ```ts
43
- import { tokensPreset } from "@vvedantb/ui/tokens/tailwind-preset";
44
-
45
- export default {
46
- presets: [tokensPreset()],
47
- // or tokensPreset({ color: (name) => `color-mix(in oklch, var(--${name}) calc(<alpha-value> * 100%), transparent)` })
48
- content: ["./src/**/*.{ts,tsx}"],
49
- theme: { extend: { /* app-only colours, fonts, animations */ } },
50
- plugins: [tailwindcssAnimate],
51
- };
52
- ```
53
-
54
- The preset holds `darkMode: "class"`, the shared colour map (`border`, `surface.*`, `danger.*`, `field.*`, shadcn aliases `primary`/`secondary`/`destructive`/`card`/`popover`/`input` ...), `borderRadius` lg/md/sm/field, `boxShadow` soft/panel/insetSoft, `ease-smooth`, `screens` xs to 2xl in px, and the aurora / fade-in-up / indeterminate / accordion keyframes. It does not hold plugins, `content`, fonts, `accent`/`muted`/`ring`/`sidebar` (they differ per app) or accordion timings.
55
-
56
- Do not import `css/animations.css` in an app that uses the preset: the preset already defines the same keyframes and animations.
57
-
58
- ### Where to put the imports
59
-
60
- Tailwind inlines an `@import` where it sits, even in the middle of a file (it must be at top level, not inside an `@layer` block). Put each import where the app's own copy of the rules was. Within one layer, later rules win at equal specificity, so moving shared rules above or below app rules can flip the result for elements matched by both. `examples/migration.md` gives the exact position for each app, and `pnpm --filter @vvedantb/ui verify` checks it.
61
-
62
- ### Variables each file needs
63
-
64
- | File | Needs | Provided by |
65
- | --- | --- | --- |
66
- | `base.css` | `--accent`, `--foreground` | tokens.css or the app theme |
67
- | `dialog.css` | none | |
68
- | `modal.css` | `--modal-open-dur`, `--modal-close-dur`, `--modal-scale`, `--modal-scale-close`, `--modal-ease` | app `:root` |
69
- | `tabs.css` | `--tabs-dur`, `--tabs-ease` (app `:root`); `--tabs-text-muted`, `--tabs-text-active`, `--tabs-pill-bg` | colours: tabs-pills.css or the app theme |
70
- | `tabs-pills.css` | `--muted`, `--segment`, `--segment-foreground`, `--default` | tokens.css or the app theme |
71
- | `utilities.css` | `--breakpoint-sm` (Tailwind default or app theme) | Tailwind |
72
- | `scrollbar-thin.css` | `--scrollbar` | tokens.css or the app theme |
73
- | `animations.css` | none | |
74
- | `tailwind-preset` | the CSS variables named in its colour map, `--radius`, `--field-radius` | tokens.css or the app theme |
75
-
76
- ### Using an existing shadcn RGB theme
77
-
78
- See the package `README.md`. With the compat file, `base.css`, `scrollbar-thin.css`, `utilities.css`, `dialog.css`, `modal.css` and `tabs.css` need no `tokens.css`. `base.css` reads `--accent` and `--foreground` and `tabs-pills.css` reads `--muted`, `--segment` and `--default`. Those are not channel-compatible, so skip `tabs-pills.css` and `index.css` (which includes `base.css`) unless the app defines those variables as full colours.
79
-
80
- ### Parameters
81
-
82
- Where apps share a rule but drifted in one value, the value is a custom property whose fallback is the most common value. Set it on `:root` to keep a different value.
83
-
84
- | File | Property | Default | Set by |
85
- | --- | --- | --- | --- |
86
- | `base.css` | `--tokens-control-transition-property` | `background-color, border-color, color, box-shadow, transform, opacity` | app-c: `background-color, color, transform, opacity` |
87
- | `base.css` | `--tokens-control-transition-duration` | `240ms` | app-c: `100ms` |
88
-
89
- ## Develop
90
-
91
- ```sh
92
- pnpm --filter @vvedantb/ui build # export targets exist + tsc (primitives, shell, app)
93
- pnpm --filter @vvedantb/ui test # vitest (app helpers) + offline node --test: exports, CSS structure, Tailwind compile, preset
94
- pnpm --filter @vvedantb/ui analyze # rule-level duplication across the app clones -> verify/ANALYSIS.tables.md
95
- pnpm --filter @vvedantb/ui verify # before/after compile of every app -> verify/RESULTS.md, examples/migration.md
96
- ```
97
-
98
- `analyze` and `verify` need the app clones (`APPS_DIR`, default `/workspace/cvx`; name or symlink the clones `app-a` to `app-e` inside it) and network access the first time: they install Tailwind 4.3.3, the plugins, postcss and jiti into a scratch directory (`VERIFY_DIR`, default `/workspace/pk-tokens-verify`, outside the repo). The migration for each app is data in `verify/migrations/<app>.json`. Each removed block must equal the shared file's block with the same context and selector, or the run fails.