@vvedantb/ui 0.27.0 → 0.29.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/README.md +55 -3
- package/fonts/InstrumentSans-Italic-latin-ext.woff2 +0 -0
- package/fonts/InstrumentSans-Italic-latin.woff2 +0 -0
- package/fonts/InstrumentSans-latin-ext.woff2 +0 -0
- package/fonts/InstrumentSans-latin.woff2 +0 -0
- package/fonts/OFL.txt +93 -0
- package/fonts/instrument-sans.css +73 -0
- package/package.json +23 -17
- package/scripts/build-brand-assets.mjs +12 -3
- package/src/client.ts +393 -0
- package/src/marketing/SiteFooter.tsx +27 -19
- package/app/README.md +0 -259
- package/tokens/README.md +0 -120
package/README.md
CHANGED
|
@@ -4,13 +4,16 @@ Shared React 19 web UI. Source-exported: no build step.
|
|
|
4
4
|
|
|
5
5
|
| Import | What it is |
|
|
6
6
|
| --- | --- |
|
|
7
|
-
| `@vvedantb/ui` | The
|
|
7
|
+
| `@vvedantb/ui` | The main JavaScript entry. Primitives (Radix-based), AI elements, audio (`playChime`, `useReplyChime`, `playTone`), `toast` and `SonnerToaster`, the composer (`InputArea`, deprecated 0.3 `Composer`), shell (`SidebarHeader`, `SidebarUpgradeCard`, `PillTabs`, `SessionsHoverCard`, and the app shell: `AppShell`, `AppSidebar`, `SidebarRail`, `RailTile`, `SidebarPanel`, `SidebarAccountMenu`, `SignOutDialog` and related helpers), app helpers (confirm skip, update watcher, settings chrome, `useStableAuth`, and from 0.8.0 `createThemeProvider`, `createPageTitleContext`, `PageMotionProvider` and `formatCompactRelativeTime`), marketing pieces from 0.9.0 (`createLandingKit` and the `Landing*` parts, `SiteFooter`, `PricingModal`), animated nav icons from 0.11.0 (`MemoryIcon`, `BoardIcon`, ... and `NavIconBase`; `SettingsIcon` `variant` from 0.12.0), artifact viewers from 0.13.0 (`ArtifactFrame`, `ArtifactList`, `ArtifactViewer`, ...), date pickers from 0.14.0 (`Calendar`, `DatePicker`, `DateTimePicker`, `MonthPicker`), `cn`, and the native tokens `tokens` and `Tokens`. See `app/README.md` in the repository for the app helpers. |
|
|
8
|
+
| `@vvedantb/ui/client` | The root without `@vvedantb/server`, convex or Clerk, for Chrome extensions (0.28.0). Leaves out the artifact viewers, `ConvexClerkProvider`, `useStableAuth`, `createUseStableAuth`, `resetStableAuthSession` and `useEnsureUser`. See [Chrome extensions](#chrome-extensions-0280). |
|
|
9
|
+
| `@vvedantb/ui/brand` | App icons (`Icon*`, `APP_ICONS`), `AppWordmark`, deprecated `AppMark`, raw SVG strings and `FAMILY_APPS`. Also in the root and `/client`. |
|
|
8
10
|
| `@vvedantb/ui/tokens` | `tokens.css`: colour, radius, shadow, ease and font tokens for Tailwind v4. CSS. |
|
|
9
11
|
| `@vvedantb/ui/tokens/tokens.css` | Same file as `@vvedantb/ui/tokens`. CSS. |
|
|
10
12
|
| `@vvedantb/ui/tokens/css/*.css` | `index`, `base`, `dialog`, `modal`, `tabs`, `tabs-pills`, `utilities`, `scrollbar-thin`, `clear-input`, `motion`, `animations`, `nav-icons`, `compat-shadcn-rgb`, `border-beam` (opt-in, for `BorderBeam`), `markdown` (opt-in, for `Markdown`). CSS. `tokens.css` imports `scrollbar-thin`, `clear-input` and `motion`. |
|
|
11
13
|
| `@vvedantb/ui/tokens/compat/shadcn-rgb.css` | Same file as `tokens/css/compat-shadcn-rgb.css`. CSS. |
|
|
12
14
|
| `@vvedantb/ui/tokens/tailwind-preset` | Tailwind preset (`.mjs`) for `@config "@vvedantb/ui/tokens/tailwind-preset"`. Kept as a build-tool entry: Tailwind needs a resolvable package path, and it is not a React API. |
|
|
13
15
|
| `@vvedantb/ui/landing.css` | Landing page classes (`landing-wordmark-text` for `AppWordmark`, `landing-atmosphere`, `landing-grain`, `landing-pulse-dot`, ambient graph and preview animations, smooth `#top` scrolling). CSS. |
|
|
16
|
+
| `@vvedantb/ui/fonts/instrument-sans.css` | Instrument Sans `@font-face` rules over packaged woff2 files, and the Clerk Inter override, for extension pages (0.28.0). Opt-in. CSS. |
|
|
14
17
|
| `@vvedantb/ui/package.json` | Package metadata. |
|
|
15
18
|
|
|
16
19
|
Removed in 0.4.0-rc.1: the `/cn`, `/sonner`, `/audio`, `/shell`, `/app`, `/composer` and `/tokens/native` subpaths. Import from `@vvedantb/ui`. See [`MIGRATION.md`](MIGRATION.md).
|
|
@@ -871,7 +874,7 @@ links under a separator.
|
|
|
871
874
|
| --- | --- |
|
|
872
875
|
| `brand`, `tagline` | Nodes. |
|
|
873
876
|
| `socials` | `{ href, icon, label? }[]`. `icon` is a component that takes `className`. Links open in a new tab. |
|
|
874
|
-
| `columns` | `{ heading, links }[]`. A link is `{ href, label, external?, image?: { src, alt } }`. |
|
|
877
|
+
| `columns` | `{ heading, links }[]`. A link is `{ href, label, external?, image?: { src, alt }, app?: AppName }`. `image` is a 20px round image before the label. `app` (0.29.0) is the 14px `APP_ICONS[app]` glyph before the label, in `currentColor` and `aria-hidden`. If both are set, `app` wins. |
|
|
875
878
|
| `name`, `year` | "Copyright © {year} {name}". `year` defaults to the current year. |
|
|
876
879
|
| `legalLinks` | `{ href, label }[]`, open in a new tab. |
|
|
877
880
|
| `variant` | `"muted"` (default, `text-muted`), `"muted-foreground"`, or `"touch"` (`text-muted-foreground`, `max-sm:hit-target` links, safe-area bottom padding). |
|
|
@@ -910,7 +913,7 @@ Shared marketing wordmark for product app names across Project V sites: the `Ico
|
|
|
910
913
|
|
|
911
914
|
Never use `AppWordmark` for `projectv` (the type rejects it).
|
|
912
915
|
|
|
913
|
-
Setup.
|
|
916
|
+
Setup. `--font-sans` comes from the package tokens. Load Instrument Sans in the app, as for the rest of the UI, if it is not already loaded. Extension pages can import `@vvedantb/ui/fonts/instrument-sans.css` (0.28.0); web apps keep their own font loading.
|
|
914
917
|
|
|
915
918
|
```css
|
|
916
919
|
@import "@vvedantb/ui/landing.css"; /* provides .landing-wordmark-text */
|
|
@@ -1209,6 +1212,55 @@ import {
|
|
|
1209
1212
|
- Hooks: `useMediaQuery(query)`, `useDocumentVisible()`, `useIdleCallback(ms, fn)` (trailing debounce; `createIdleCallback` is the React-free core), `useSingleFlight(fn)` (one call at a time, latest args run next), `usePersistedScrollParent(storageKey)` (restores a container's `scrollTop` from `sessionStorage`).
|
|
1210
1213
|
- Convex: `convexErrorMessage(error, fallback)` reads `ConvexError` data first; `userFacingErrorMessage(error, fallback)` strips the client envelope and stack. `useHeldResult(result, key)` keeps the last result while a query is skipped (`key` `null`). None of these import `convex`.
|
|
1211
1214
|
|
|
1215
|
+
## Chrome extensions (0.28.0)
|
|
1216
|
+
|
|
1217
|
+
Extension pages (popup, side panel, options, welcome) run under the MV3 extension-page CSP, which blocks remote font stylesheets, and should not load `@vvedantb/server`. Three pieces cover them. Web apps change nothing unless they opt in.
|
|
1218
|
+
|
|
1219
|
+
### Fonts
|
|
1220
|
+
|
|
1221
|
+
```css
|
|
1222
|
+
@import "tailwindcss";
|
|
1223
|
+
@import "@vvedantb/ui/tokens";
|
|
1224
|
+
@import "@vvedantb/ui/fonts/instrument-sans.css";
|
|
1225
|
+
@source "../node_modules/@vvedantb/ui/src/**/*.{ts,tsx}";
|
|
1226
|
+
```
|
|
1227
|
+
|
|
1228
|
+
`instrument-sans.css` has four `@font-face` rules: variable weight 400-700, normal and italic, latin and latin-ext. The `url()`s are relative, so Vite and WXT copy the woff2 files into the build. The licence is `fonts/OFL.txt`. The file ends with the rule both extensions carried in `globals.css`:
|
|
1229
|
+
|
|
1230
|
+
```css
|
|
1231
|
+
html,
|
|
1232
|
+
body {
|
|
1233
|
+
font-family: var(--font-sans);
|
|
1234
|
+
}
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
Clerk injects an unlayered `body { font-family: Inter }`, which beats the `@layer base` rule in the tokens; this rule is unlayered too. `tokens.css` does not import the file. Once an extension imports it, it can drop its own copy of the fonts, the CSS and the override.
|
|
1238
|
+
|
|
1239
|
+
### `@vvedantb/ui/client`
|
|
1240
|
+
|
|
1241
|
+
```tsx
|
|
1242
|
+
import { AppWordmark, Button, Card, Tabs, TabsList, TabsTrigger, cn, createThemeProvider } from "@vvedantb/ui/client";
|
|
1243
|
+
```
|
|
1244
|
+
|
|
1245
|
+
The root's exports, without:
|
|
1246
|
+
|
|
1247
|
+
- the artifact viewers (`src/artifacts`: `ArtifactFrame`, `ArtifactViewer`, ...), which import `@vvedantb/server`;
|
|
1248
|
+
- `ConvexClerkProvider`, `useStableAuth`, `createUseStableAuth`, `resetStableAuthSession` and `useEnsureUser`, which import `convex` or `@clerk/clerk-react`.
|
|
1249
|
+
|
|
1250
|
+
Every other name is the same binding as in the root. `src/client-exports.test.ts` keeps the two in step, and `app/tests-node/client-graph.test.mjs` checks that the entry's module graph has no `@vvedantb/server`, convex, Clerk or `node:` import. The root is unchanged.
|
|
1251
|
+
|
|
1252
|
+
### Icons
|
|
1253
|
+
|
|
1254
|
+
`scripts/build-brand-assets.mjs` ships in the package and writes `<out>/<app>/extension/icon-{16,32,48,128}.png` (the tile at 16, 32 and 48 px, `appExtension128Svg` at 128 px). Copy them into the extension's public folder:
|
|
1255
|
+
|
|
1256
|
+
```sh
|
|
1257
|
+
out=$(mktemp -d)
|
|
1258
|
+
node node_modules/@vvedantb/ui/scripts/build-brand-assets.mjs --out "$out" --app vmem
|
|
1259
|
+
mkdir -p public/icons && cp "$out"/vmem/extension/icon-*.png public/icons/
|
|
1260
|
+
```
|
|
1261
|
+
|
|
1262
|
+
PNGs need `rsvg-convert` (librsvg); without it the script writes only the SVGs and says so. It needs Node 22.18 or later. Under `node_modules` it strips the types from `src/brand/svg.ts` itself, because Node will not, and Node prints an `ExperimentalWarning` for that. `defineVExtensionConfig` in `@vvedantb/config/extension` points the manifest `icons` and `action.default_icon` at `icons/icon-{16,32,48,128}.png`.
|
|
1263
|
+
|
|
1212
1264
|
## Slider (0.16.0, dark contrast and className props 0.16.1)
|
|
1213
1265
|
|
|
1214
1266
|
shadcn's slider on `@radix-ui/react-slider` (a peer dependency), with package tokens.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/fonts/OFL.txt
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright 2022 The Instrument Sans Project Authors (https://github.com/Instrument/instrument-sans)
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
This license is copied below, and is also available with a FAQ at:
|
|
5
|
+
https://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @vvedantb/ui/fonts/instrument-sans.css: Instrument Sans for chrome-extension
|
|
3
|
+
* pages (popup, welcome). Opt-in: tokens.css does not import it, so web apps
|
|
4
|
+
* are unchanged.
|
|
5
|
+
*
|
|
6
|
+
* @import "@vvedantb/ui/fonts/instrument-sans.css";
|
|
7
|
+
*
|
|
8
|
+
* @vvedantb/ui/tokens only names the family; MV3 extension-page CSP cannot load
|
|
9
|
+
* remote webfont stylesheets, so the files ship here. Variable weight 400-700,
|
|
10
|
+
* normal and italic, latin and latin-ext. The url()s are relative, so Vite and
|
|
11
|
+
* WXT copy the woff2 files into the build. Licence: OFL.txt in this folder.
|
|
12
|
+
*
|
|
13
|
+
* The last rule sets html and body to --font-sans (from @vvedantb/ui/tokens).
|
|
14
|
+
* It is unlayered on purpose: see the comment above it.
|
|
15
|
+
*/
|
|
16
|
+
@font-face {
|
|
17
|
+
font-family: "Instrument Sans";
|
|
18
|
+
font-style: italic;
|
|
19
|
+
font-weight: 400 700;
|
|
20
|
+
font-stretch: 100%;
|
|
21
|
+
font-display: swap;
|
|
22
|
+
src: url("./InstrumentSans-Italic-latin-ext.woff2") format("woff2");
|
|
23
|
+
unicode-range:
|
|
24
|
+
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
|
|
25
|
+
U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
|
|
26
|
+
U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@font-face {
|
|
30
|
+
font-family: "Instrument Sans";
|
|
31
|
+
font-style: italic;
|
|
32
|
+
font-weight: 400 700;
|
|
33
|
+
font-stretch: 100%;
|
|
34
|
+
font-display: swap;
|
|
35
|
+
src: url("./InstrumentSans-Italic-latin.woff2") format("woff2");
|
|
36
|
+
unicode-range:
|
|
37
|
+
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
|
|
38
|
+
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
|
|
39
|
+
U+2215, U+FEFF, U+FFFD;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@font-face {
|
|
43
|
+
font-family: "Instrument Sans";
|
|
44
|
+
font-style: normal;
|
|
45
|
+
font-weight: 400 700;
|
|
46
|
+
font-stretch: 100%;
|
|
47
|
+
font-display: swap;
|
|
48
|
+
src: url("./InstrumentSans-latin-ext.woff2") format("woff2");
|
|
49
|
+
unicode-range:
|
|
50
|
+
U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
|
|
51
|
+
U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB,
|
|
52
|
+
U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@font-face {
|
|
56
|
+
font-family: "Instrument Sans";
|
|
57
|
+
font-style: normal;
|
|
58
|
+
font-weight: 400 700;
|
|
59
|
+
font-stretch: 100%;
|
|
60
|
+
font-display: swap;
|
|
61
|
+
src: url("./InstrumentSans-latin.woff2") format("woff2");
|
|
62
|
+
unicode-range:
|
|
63
|
+
U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
|
|
64
|
+
U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212,
|
|
65
|
+
U+2215, U+FEFF, U+FFFD;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Clerk injects unlayered `body { font-family: Inter }` which beats
|
|
69
|
+
* `@layer base` from @vvedantb/ui/tokens. Keep extension pages on Instrument Sans. */
|
|
70
|
+
html,
|
|
71
|
+
body {
|
|
72
|
+
font-family: var(--font-sans);
|
|
73
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "Shared React 19 UI for web apps: one JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), design-token CSS, shared Tailwind v4 CSS
|
|
5
|
+
"description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
@@ -45,7 +45,12 @@
|
|
|
45
45
|
"types": "./src/brand/index.ts",
|
|
46
46
|
"default": "./src/brand/index.ts"
|
|
47
47
|
},
|
|
48
|
+
"./client": {
|
|
49
|
+
"types": "./src/client.ts",
|
|
50
|
+
"default": "./src/client.ts"
|
|
51
|
+
},
|
|
48
52
|
"./landing.css": "./src/marketing/landing.css",
|
|
53
|
+
"./fonts/instrument-sans.css": "./fonts/instrument-sans.css",
|
|
49
54
|
"./package.json": "./package.json"
|
|
50
55
|
},
|
|
51
56
|
"types": "./src/index.ts",
|
|
@@ -55,6 +60,7 @@
|
|
|
55
60
|
"app/src",
|
|
56
61
|
"tokens/src",
|
|
57
62
|
"tokens/examples",
|
|
63
|
+
"fonts",
|
|
58
64
|
"scripts/build-brand-assets.mjs",
|
|
59
65
|
"README.md",
|
|
60
66
|
"LICENSE",
|
|
@@ -63,19 +69,9 @@
|
|
|
63
69
|
],
|
|
64
70
|
"sideEffects": [
|
|
65
71
|
"./src/ui/sonner.css",
|
|
66
|
-
"./src/marketing/landing.css"
|
|
72
|
+
"./src/marketing/landing.css",
|
|
73
|
+
"./fonts/instrument-sans.css"
|
|
67
74
|
],
|
|
68
|
-
"scripts": {
|
|
69
|
-
"check:tokens": "node tokens/scripts/check-component-tokens.mjs",
|
|
70
|
-
"build": "node tokens/scripts/check-exports.mjs && node tokens/scripts/check-component-tokens.mjs && tsc -p tsconfig.json",
|
|
71
|
-
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.consumer.json && tsc -p tsconfig.consumer-speech.json && tsc -p tokens/tsconfig.json",
|
|
72
|
-
"test": "node tokens/scripts/check-component-tokens.mjs && vitest run && node --test tokens/test/*.test.mjs app/tests-node/*.test.mjs",
|
|
73
|
-
"verify": "node tokens/scripts/check-component-tokens.mjs && node tokens/verify/run.mjs",
|
|
74
|
-
"analyze": "node tokens/verify/analyze.mjs",
|
|
75
|
-
"brand:assets": "node scripts/build-brand-assets.mjs",
|
|
76
|
-
"brand:sheet": "node scripts/build-brand-sheet.mjs",
|
|
77
|
-
"prepack": "node tokens/scripts/check-exports.mjs"
|
|
78
|
-
},
|
|
79
75
|
"dependencies": {
|
|
80
76
|
"@dnd-kit/core": "^6.3.1",
|
|
81
77
|
"@dnd-kit/modifiers": "^9.0.0",
|
|
@@ -165,7 +161,6 @@
|
|
|
165
161
|
"@tanstack/react-hotkeys": "^0.13.0",
|
|
166
162
|
"@types/react": "^19.1.0",
|
|
167
163
|
"@types/react-dom": "^19.1.0",
|
|
168
|
-
"@vvedantb/server": "workspace:*",
|
|
169
164
|
"ai": "^5.0.0",
|
|
170
165
|
"class-variance-authority": "^0.7.1",
|
|
171
166
|
"clsx": "^2.1.1",
|
|
@@ -189,7 +184,8 @@
|
|
|
189
184
|
"vaul": "^1.1.0",
|
|
190
185
|
"vitest": "^3.2.0",
|
|
191
186
|
"zod": "^4.0.0",
|
|
192
|
-
"zod3": "npm:zod@^3.25.76"
|
|
187
|
+
"zod3": "npm:zod@^3.25.76",
|
|
188
|
+
"@vvedantb/server": "0.10.0"
|
|
193
189
|
},
|
|
194
190
|
"peerDependenciesMeta": {
|
|
195
191
|
"@clerk/clerk-react": {
|
|
@@ -210,5 +206,15 @@
|
|
|
210
206
|
"@vvedantb/server": {
|
|
211
207
|
"optional": true
|
|
212
208
|
}
|
|
209
|
+
},
|
|
210
|
+
"scripts": {
|
|
211
|
+
"check:tokens": "node tokens/scripts/check-component-tokens.mjs",
|
|
212
|
+
"build": "node tokens/scripts/check-exports.mjs && node tokens/scripts/check-component-tokens.mjs && tsc -p tsconfig.json",
|
|
213
|
+
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.consumer.json && tsc -p tsconfig.consumer-speech.json && tsc -p tokens/tsconfig.json",
|
|
214
|
+
"test": "node tokens/scripts/check-component-tokens.mjs && vitest run && node --test tokens/test/*.test.mjs app/tests-node/*.test.mjs",
|
|
215
|
+
"verify": "node tokens/scripts/check-component-tokens.mjs && node tokens/verify/run.mjs",
|
|
216
|
+
"analyze": "node tokens/verify/analyze.mjs",
|
|
217
|
+
"brand:assets": "node scripts/build-brand-assets.mjs",
|
|
218
|
+
"brand:sheet": "node scripts/build-brand-sheet.mjs"
|
|
213
219
|
}
|
|
214
|
-
}
|
|
220
|
+
}
|
|
@@ -5,10 +5,19 @@
|
|
|
5
5
|
// SVGs are always written. PNGs and favicon.ico need `rsvg-convert`; without it they are skipped
|
|
6
6
|
// with a message. Layout: <dir>/<app>/{mark,icon,favicon,icon-light}.svg, PNGs, extension/, android/.
|
|
7
7
|
import { spawnSync } from "node:child_process";
|
|
8
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
9
|
-
import { dirname, join } from "node:path";
|
|
8
|
+
import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
9
|
+
import { dirname, join, sep } from "node:path";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
// Node does not strip types from files under node_modules, so an installed copy
|
|
13
|
+
// of this script strips svg.ts itself (svg.ts has no imports).
|
|
14
|
+
async function loadSvg() {
|
|
15
|
+
const url = new URL("../src/brand/svg.ts", import.meta.url);
|
|
16
|
+
if (!fileURLToPath(url).split(sep).includes("node_modules")) return import(url.href);
|
|
17
|
+
const { stripTypeScriptTypes } = await import("node:module");
|
|
18
|
+
return import(`data:text/javascript,${encodeURIComponent(stripTypeScriptTypes(readFileSync(url, "utf8")))}`);
|
|
19
|
+
}
|
|
20
|
+
const { APP_NAMES, appAdaptiveSvg, appExtension128Svg, appMarkSvg, appTileSvg } = await loadSvg();
|
|
12
21
|
|
|
13
22
|
/** Whether `rsvg-convert` can be run. */
|
|
14
23
|
export function hasRsvg() {
|
package/src/client.ts
ADDED
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// @vvedantb/ui/client: the root without `@vvedantb/server`, convex or Clerk, for
|
|
2
|
+
// Chrome extensions and other pages that cannot load them. It leaves out the
|
|
3
|
+
// artifact viewers (`src/artifacts`), `ConvexClerkProvider`, `useStableAuth`
|
|
4
|
+
// and `useEnsureUser`; everything else matches the root. Keep it in step with
|
|
5
|
+
// src/index.ts: src/client-exports.test.ts compares the two, and
|
|
6
|
+
// app/tests-node/client-graph.test.mjs checks the module graph.
|
|
7
|
+
export { cn } from "./utils/cn";
|
|
8
|
+
export { UiConfigProvider, useUiConfig } from "./ui/ui-config";
|
|
9
|
+
export type { UiConfig, UiConfigProviderProps } from "./ui/ui-config";
|
|
10
|
+
export { floatingSurfaceClass } from "./ui/_menu-classes";
|
|
11
|
+
export { fieldFocusClass, fieldFocusWithinClass } from "./ui/_field-classes";
|
|
12
|
+
export * from "./ui/surface-classes";
|
|
13
|
+
export * from "./motion/presets";
|
|
14
|
+
export * from "./motion/panel-transition";
|
|
15
|
+
export { ListEnter, useFirstPaintGate } from "./motion/list-enter";
|
|
16
|
+
export type { ListEnterProps } from "./motion/list-enter";
|
|
17
|
+
// Gesture physics and animation budget helpers (shared clock, on-screen and
|
|
18
|
+
// page-visibility pausing for infinite animations).
|
|
19
|
+
export { DRAG_ACTIVATION_DISTANCE_PX, projectVelocity, rubberband } from "./utils/gesture";
|
|
20
|
+
export {
|
|
21
|
+
bindRuntimeAnimation,
|
|
22
|
+
ensureRuntimeVisibility,
|
|
23
|
+
observeAnimVisibility,
|
|
24
|
+
useAnimOffscreenRef,
|
|
25
|
+
} from "./utils/runtimeVisibility";
|
|
26
|
+
export { msUntilNextBoundary, quantizedSnapshot, subscribeQuantized } from "./utils/sharedClock";
|
|
27
|
+
export { CAT_SLOT_COUNT, catColorForId, catColorForSlot, catSlotForId } from "./utils/cat-color";
|
|
28
|
+
export type { CatColorClasses, CatSlot } from "./utils/cat-color";
|
|
29
|
+
export { CONTROL_RADIUS_CLASS, SURFACE_RADIUS_CLASS } from "./utils/surface-radius";
|
|
30
|
+
export { restoreModalScrollLock } from "./ui/overlay-a11y";
|
|
31
|
+
// Generic hooks: media query, page visibility, trailing debounce,
|
|
32
|
+
// single-flight async calls and a persisted scroll container.
|
|
33
|
+
export * from "./hooks";
|
|
34
|
+
export { ErrorBoundary } from "./ui/error-boundary";
|
|
35
|
+
export type { ErrorBoundaryProps } from "./ui/error-boundary";
|
|
36
|
+
export { CountPop, countLabel, UnreadDot } from "./ui/count-pop";
|
|
37
|
+
export { MarqueeOnHover } from "./ui/marquee-on-hover";
|
|
38
|
+
export { RelativeDateTime } from "./ui/relative-date-time";
|
|
39
|
+
export type { RelativeDateTimeProps } from "./ui/relative-date-time";
|
|
40
|
+
export { ImageLightbox } from "./ui/image-lightbox";
|
|
41
|
+
export type { GalleryImage } from "./ui/image-lightbox";
|
|
42
|
+
export { ImageGalleryPreview, ScreenshotPreview, VideoPreview } from "./ui/media-preview";
|
|
43
|
+
|
|
44
|
+
export * from "./ui/avatar";
|
|
45
|
+
export * from "./ui/badge";
|
|
46
|
+
export * from "./ui/border-beam";
|
|
47
|
+
export * from "./ui/breadcrumb";
|
|
48
|
+
export * from "./ui/button";
|
|
49
|
+
export * from "./ui/button-group";
|
|
50
|
+
export * from "./ui/card";
|
|
51
|
+
export * from "./ui/carousel";
|
|
52
|
+
export * from "./ui/centered-spinner";
|
|
53
|
+
export * from "./ui/checkbox";
|
|
54
|
+
export * from "./ui/collapsible";
|
|
55
|
+
export * from "./ui/command";
|
|
56
|
+
export * from "./ui/context-menu";
|
|
57
|
+
export * from "./ui/crossfade-icon";
|
|
58
|
+
export * from "./ui/dialog";
|
|
59
|
+
export * from "./ui/alert-dialog";
|
|
60
|
+
export * from "./ui/confirm-dialog";
|
|
61
|
+
export * from "./ui/dropdown-menu";
|
|
62
|
+
export * from "./ui/empty-state";
|
|
63
|
+
export * from "./ui/hover-card";
|
|
64
|
+
export * from "./ui/input";
|
|
65
|
+
export * from "./ui/label";
|
|
66
|
+
export * from "./ui/labeled-slider-row";
|
|
67
|
+
export * from "./ui/labeled-switch-row";
|
|
68
|
+
export * from "./ui/list-row";
|
|
69
|
+
export * from "./ui/loading-state";
|
|
70
|
+
export * from "./ui/pagination";
|
|
71
|
+
export * from "./ui/popover";
|
|
72
|
+
export * from "./ui/progress";
|
|
73
|
+
export * from "./ui/refresh-spin-icon";
|
|
74
|
+
export {
|
|
75
|
+
Select as RadixSelect,
|
|
76
|
+
SelectContent as RadixSelectContent,
|
|
77
|
+
SelectGroup as RadixSelectGroup,
|
|
78
|
+
SelectItem as RadixSelectItem,
|
|
79
|
+
SelectLabel as RadixSelectLabel,
|
|
80
|
+
SelectScrollDownButton as RadixSelectScrollDownButton,
|
|
81
|
+
SelectScrollUpButton as RadixSelectScrollUpButton,
|
|
82
|
+
SelectSeparator as RadixSelectSeparator,
|
|
83
|
+
SelectTrigger as RadixSelectTrigger,
|
|
84
|
+
SelectValue as RadixSelectValue,
|
|
85
|
+
} from "./ui/radix-select";
|
|
86
|
+
export * from "./ui/search-input";
|
|
87
|
+
export * from "./ui/select";
|
|
88
|
+
export * from "./ui/select-field";
|
|
89
|
+
export * from "./ui/separator";
|
|
90
|
+
export * from "./ui/skeleton";
|
|
91
|
+
export * from "./ui/slide-over-panel";
|
|
92
|
+
export * from "./ui/slider";
|
|
93
|
+
export * from "./ui/sonner";
|
|
94
|
+
export * from "./ui/spinner";
|
|
95
|
+
export * from "./ui/status-dot";
|
|
96
|
+
export * from "./ui/surface";
|
|
97
|
+
export * from "./ui/switch";
|
|
98
|
+
export * from "./ui/table";
|
|
99
|
+
export * from "./ui/tabs";
|
|
100
|
+
export * from "./ui/textarea";
|
|
101
|
+
export * from "./ui/toolbar-search-input";
|
|
102
|
+
export * from "./ui/time-picker";
|
|
103
|
+
export * from "./ui/calendar";
|
|
104
|
+
export * from "./ui/date-picker";
|
|
105
|
+
export * from "./ui/tooltip";
|
|
106
|
+
export * from "./ui/kbd";
|
|
107
|
+
export * from "./ui/sheet";
|
|
108
|
+
export * from "./ui/visually-hidden";
|
|
109
|
+
export * from "./ui/clearInputDissolve";
|
|
110
|
+
|
|
111
|
+
// Animated nav icons. Styles: `@vvedantb/ui/tokens/css/nav-icons.css`.
|
|
112
|
+
export * from "./icons";
|
|
113
|
+
|
|
114
|
+
// Dual copies: the richer file uses the plain name. The deprecated `Alt` exports
|
|
115
|
+
// (accordion, clear input, input group) wrap the main parts with the old markup.
|
|
116
|
+
export * from "./ui/accordion";
|
|
117
|
+
export {
|
|
118
|
+
AccordionAlt,
|
|
119
|
+
AccordionItemAlt,
|
|
120
|
+
AccordionTriggerAlt,
|
|
121
|
+
AccordionContentAlt,
|
|
122
|
+
} from "./ui/accordion.alt";
|
|
123
|
+
export * from "./ui/clear-input";
|
|
124
|
+
export { ClearInputAlt } from "./ui/clear-input.alt";
|
|
125
|
+
export * from "./ui/input-group";
|
|
126
|
+
export {
|
|
127
|
+
InputGroupAlt,
|
|
128
|
+
InputGroupAddonAlt,
|
|
129
|
+
InputGroupButtonAlt,
|
|
130
|
+
InputGroupTextAlt,
|
|
131
|
+
InputGroupInputAlt,
|
|
132
|
+
InputGroupTextareaAlt,
|
|
133
|
+
} from "./ui/input-group.alt";
|
|
134
|
+
export * from "./ui/scroll-area";
|
|
135
|
+
export {
|
|
136
|
+
ScrollArea as ScrollAreaAlt,
|
|
137
|
+
ScrollBar as ScrollBarAlt,
|
|
138
|
+
} from "./ui/scroll-area.alt";
|
|
139
|
+
|
|
140
|
+
export * from "./ai-elements/artifact";
|
|
141
|
+
export * from "./ai-elements/attachments";
|
|
142
|
+
export * from "./ai-elements/chain-of-thought";
|
|
143
|
+
export * from "./ai-elements/code-block";
|
|
144
|
+
export * from "./ai-elements/conversation";
|
|
145
|
+
export * from "./ai-elements/file-chip";
|
|
146
|
+
export * from "./ai-elements/image";
|
|
147
|
+
export * from "./ai-elements/inline-citation";
|
|
148
|
+
export * from "./ai-elements/jump-rail";
|
|
149
|
+
export * from "./ai-elements/jump-rail-geometry";
|
|
150
|
+
export * from "./ai-elements/chat-jump-rail";
|
|
151
|
+
export * from "./ai-elements/message";
|
|
152
|
+
export * from "./ai-elements/model-selector";
|
|
153
|
+
export * from "./ai-elements/prompt-input";
|
|
154
|
+
export * from "./ai-elements/prompt-input-settings";
|
|
155
|
+
export * from "./ai-elements/prompt-input-speech";
|
|
156
|
+
export * from "./ai-elements/prompt-input-traits";
|
|
157
|
+
export * from "./ai-elements/queue";
|
|
158
|
+
export * from "./ai-elements/reasoning";
|
|
159
|
+
export * from "./ai-elements/shimmer";
|
|
160
|
+
export * from "./ai-elements/sources";
|
|
161
|
+
export * from "./ai-elements/speech-input";
|
|
162
|
+
export * from "./ai-elements/suggestion";
|
|
163
|
+
|
|
164
|
+
// Agent activity and run surfaces (moved from an app): the activity timeline and
|
|
165
|
+
// its step model, Trace lines, plan, test results, web preview, context usage
|
|
166
|
+
// and the model picker.
|
|
167
|
+
export * from "./ai-elements/activity-shared";
|
|
168
|
+
export * from "./ai-elements/activity-question";
|
|
169
|
+
export * from "./ai-elements/activity-tasks";
|
|
170
|
+
export * from "./ai-elements/trace";
|
|
171
|
+
export * from "./ai-elements/use-streaming-disclosure";
|
|
172
|
+
export * from "./ai-elements/plan";
|
|
173
|
+
export * from "./ai-elements/test-results";
|
|
174
|
+
export * from "./ai-elements/web-preview";
|
|
175
|
+
export * from "./ai-elements/context";
|
|
176
|
+
export * from "./ai-elements/model-picker";
|
|
177
|
+
export * from "./ai-elements/provider-icon";
|
|
178
|
+
|
|
179
|
+
// Kibo UI blocks: gantt, kanban, list, contribution graph, video player,
|
|
180
|
+
// cursor, avatar stack, theme switcher. Kanban, list and gantt drag with
|
|
181
|
+
// `useDragSensors`, the shared dnd-kit sensor split.
|
|
182
|
+
export * from "./kibo";
|
|
183
|
+
export { useDragSensors } from "./utils/useDragSensors";
|
|
184
|
+
|
|
185
|
+
// Markdown renderer (Streamdown + code blocks, callouts, links, KaTeX).
|
|
186
|
+
// Styles: `@vvedantb/ui/tokens/css/markdown.css`.
|
|
187
|
+
export * from "./markdown";
|
|
188
|
+
|
|
189
|
+
export * from "./audio";
|
|
190
|
+
|
|
191
|
+
export * from "./composer";
|
|
192
|
+
export { toast } from "sonner";
|
|
193
|
+
|
|
194
|
+
// Shell: router-free pieces. Shell's own `cn` and `ClassValue` are not re-exported;
|
|
195
|
+
// use the root `cn` (clsx + tailwind-merge).
|
|
196
|
+
export { SidebarHeader } from "../shell/src/SidebarHeader";
|
|
197
|
+
export type { SidebarHeaderProps } from "../shell/src/SidebarHeader";
|
|
198
|
+
export { SidebarUpgradeCard } from "../shell/src/SidebarUpgradeCard";
|
|
199
|
+
export type { SidebarUpgradeCardProps } from "../shell/src/SidebarUpgradeCard";
|
|
200
|
+
export { PillTabs } from "../shell/src/PillTabs";
|
|
201
|
+
export type { PillTabItem, PillTabsProps } from "../shell/src/PillTabs";
|
|
202
|
+
export { SessionsHoverCard } from "../shell/src/SessionsHoverCard";
|
|
203
|
+
export type {
|
|
204
|
+
SessionsHoverCardContext,
|
|
205
|
+
SessionsHoverCardProps,
|
|
206
|
+
SessionsHoverCardSurface,
|
|
207
|
+
} from "../shell/src/SessionsHoverCard";
|
|
208
|
+
|
|
209
|
+
// App shell: sidebar and main page layout. Widths come from the
|
|
210
|
+
// `--app-shell-*` CSS variables that `AppShell` sets.
|
|
211
|
+
export { AppShell } from "../shell/src/AppShell";
|
|
212
|
+
export type {
|
|
213
|
+
AppShellContentProps,
|
|
214
|
+
AppShellMainProps,
|
|
215
|
+
AppShellProps,
|
|
216
|
+
AppShellRootProps,
|
|
217
|
+
AppShellSkipLinkProps,
|
|
218
|
+
} from "../shell/src/AppShell";
|
|
219
|
+
export { AppSidebar } from "../shell/src/AppSidebar";
|
|
220
|
+
export type { AppSidebarProps } from "../shell/src/AppSidebar";
|
|
221
|
+
// Composable sidebar parts (`Sidebar.Root`, `Sidebar.Rail`, ...) and their prop types.
|
|
222
|
+
export * from "../shell/src/Sidebar";
|
|
223
|
+
export { SidebarRail, RailTile, RailDivider, RailCollapseTile } from "../shell/src/SidebarRail";
|
|
224
|
+
export type {
|
|
225
|
+
SidebarRailProps,
|
|
226
|
+
RailTileProps,
|
|
227
|
+
RailDividerProps,
|
|
228
|
+
RailCollapseTileProps,
|
|
229
|
+
} from "../shell/src/SidebarRail";
|
|
230
|
+
export { SidebarResizeHandle, useAppShellResize } from "../shell/src/SidebarResize";
|
|
231
|
+
export type {
|
|
232
|
+
AppShellResize,
|
|
233
|
+
SidebarResizeHandleProps,
|
|
234
|
+
SidebarResizeOptions,
|
|
235
|
+
} from "../shell/src/SidebarResize";
|
|
236
|
+
export { SidebarIconTooltip } from "../shell/src/SidebarIconTooltip";
|
|
237
|
+
export type { SidebarIconTooltipProps } from "../shell/src/SidebarIconTooltip";
|
|
238
|
+
export { SidebarPanel } from "../shell/src/SidebarPanel";
|
|
239
|
+
export type { SidebarPanelProps } from "../shell/src/SidebarPanel";
|
|
240
|
+
export { SidebarAccountMenu, SidebarAccountMenuPlaceholder } from "../shell/src/SidebarAccountMenu";
|
|
241
|
+
export type {
|
|
242
|
+
SidebarAccountMenuProps,
|
|
243
|
+
SidebarAccountMenuPlaceholderProps,
|
|
244
|
+
} from "../shell/src/SidebarAccountMenu";
|
|
245
|
+
export { SignOutDialog } from "../shell/src/SignOutDialog";
|
|
246
|
+
export type { SignOutDialogProps } from "../shell/src/SignOutDialog";
|
|
247
|
+
export {
|
|
248
|
+
railBadgeClass,
|
|
249
|
+
railTileClass,
|
|
250
|
+
railTileStateClass,
|
|
251
|
+
sidebarNavIconClass,
|
|
252
|
+
sidebarNavItemActionsClass,
|
|
253
|
+
sidebarNavItemClass,
|
|
254
|
+
sidebarNavItemIndentStyle,
|
|
255
|
+
sidebarNavItemLabelClass,
|
|
256
|
+
sidebarNavItemLeadingClass,
|
|
257
|
+
sidebarNavItemSubtitleClass,
|
|
258
|
+
sidebarNavItemTrailingClass,
|
|
259
|
+
sidebarNavLinkTextClass,
|
|
260
|
+
sidebarNavRowClass,
|
|
261
|
+
sidebarSectionLabelClass,
|
|
262
|
+
} from "../shell/src/app-shell-classes";
|
|
263
|
+
export type { SidebarNavItemClassOptions } from "../shell/src/app-shell-classes";
|
|
264
|
+
|
|
265
|
+
// Marketing: landing kit, site footer and pricing dialog. Router- and Motion-free;
|
|
266
|
+
// `createLandingKit` takes the app's `motion`. Styles: `@vvedantb/ui/landing.css`.
|
|
267
|
+
export {
|
|
268
|
+
LandingFeatureCard,
|
|
269
|
+
LandingFooter,
|
|
270
|
+
LandingLattice,
|
|
271
|
+
LandingNavMenu,
|
|
272
|
+
LandingPageLayout,
|
|
273
|
+
LandingSection,
|
|
274
|
+
LandingSectionHeading,
|
|
275
|
+
landingItemVariants,
|
|
276
|
+
} from "./marketing/landing";
|
|
277
|
+
export type {
|
|
278
|
+
LandingFeature,
|
|
279
|
+
LandingFooterProps,
|
|
280
|
+
LandingLatticeProps,
|
|
281
|
+
LandingLink,
|
|
282
|
+
LandingNavMenuProps,
|
|
283
|
+
LandingPageLayoutProps,
|
|
284
|
+
LandingSectionHeadingProps,
|
|
285
|
+
LandingSectionProps,
|
|
286
|
+
} from "./marketing/landing";
|
|
287
|
+
export { createLandingKit } from "./marketing/createLandingKit";
|
|
288
|
+
export type {
|
|
289
|
+
LandingCtaProps,
|
|
290
|
+
LandingHeroProps,
|
|
291
|
+
LandingKit,
|
|
292
|
+
LandingKitOptions,
|
|
293
|
+
LandingMotion,
|
|
294
|
+
LandingNavProps,
|
|
295
|
+
LandingRevealItemProps,
|
|
296
|
+
LandingRevealProps,
|
|
297
|
+
} from "./marketing/createLandingKit";
|
|
298
|
+
export {
|
|
299
|
+
landingFooterButtonClass,
|
|
300
|
+
landingFooterLinkClass,
|
|
301
|
+
landingPanelClass,
|
|
302
|
+
landingShellClass,
|
|
303
|
+
} from "./marketing/marketing-classes";
|
|
304
|
+
export type { PricingModalTone, SiteFooterVariant } from "./marketing/marketing-classes";
|
|
305
|
+
export { SiteFooter } from "./marketing/SiteFooter";
|
|
306
|
+
export type { SiteFooterLink, SiteFooterProps, SiteFooterSocial } from "./marketing/SiteFooter";
|
|
307
|
+
export { PricingModal, V_PRO_APP_BENEFITS } from "./marketing/PricingModal";
|
|
308
|
+
export type {
|
|
309
|
+
PricingModalLegacyProps,
|
|
310
|
+
PricingModalMultiProps,
|
|
311
|
+
PricingModalPeriod,
|
|
312
|
+
PricingModalProps,
|
|
313
|
+
PricingPlan,
|
|
314
|
+
PricingPlanAppBenefit,
|
|
315
|
+
PricingPlanBenefit,
|
|
316
|
+
} from "./marketing/PricingModal";
|
|
317
|
+
|
|
318
|
+
// App helpers: confirm skip, update watcher, settings chrome, theme, page title,
|
|
319
|
+
// page motion, time, VITE env and error messages. Not here: `ConvexClerkProvider`,
|
|
320
|
+
// `useStableAuth` and `useEnsureUser`, which import convex or Clerk.
|
|
321
|
+
export {
|
|
322
|
+
bindToWindow,
|
|
323
|
+
createAltHeldStore,
|
|
324
|
+
getAltHeld,
|
|
325
|
+
useAltHeld,
|
|
326
|
+
type AltHeldBinding,
|
|
327
|
+
type AltHeldSignals,
|
|
328
|
+
type AltHeldStore,
|
|
329
|
+
type AltKeyEvent,
|
|
330
|
+
} from "../app/src/confirm/useAltHeld";
|
|
331
|
+
export { requestConfirm, shouldSkipConfirm } from "../app/src/confirm/confirmSkip";
|
|
332
|
+
export { useRequestConfirm } from "../app/src/confirm/useRequestConfirm";
|
|
333
|
+
export { ConfirmSkipHint, skipConfirmTitle } from "../app/src/confirm/ConfirmSkipHint";
|
|
334
|
+
export { fetchDeployFingerprint, fingerprintFromHtml } from "../app/src/update/deployFingerprint";
|
|
335
|
+
export {
|
|
336
|
+
startUpdateAvailableWatcher,
|
|
337
|
+
type UpdateAvailableWatcherOptions,
|
|
338
|
+
type UpdateToastOptions,
|
|
339
|
+
} from "../app/src/update/updateWatcher";
|
|
340
|
+
export { SettingsSection, type SettingsSectionConfig } from "../app/src/settings/SettingsSection";
|
|
341
|
+
export { SettingsField } from "../app/src/settings/SettingsField";
|
|
342
|
+
export { SettingsStack } from "../app/src/settings/SettingsStack";
|
|
343
|
+
export { SettingsToggleRow } from "../app/src/settings/SettingsToggleRow";
|
|
344
|
+
export { SettingsEmptyState, type SettingsEmptyStateConfig } from "../app/src/settings/SettingsEmptyState";
|
|
345
|
+
export {
|
|
346
|
+
DefaultSettingsLayout,
|
|
347
|
+
SettingsPage,
|
|
348
|
+
type SettingsLayoutProps,
|
|
349
|
+
type SettingsPageProps,
|
|
350
|
+
} from "../app/src/settings/SettingsPage";
|
|
351
|
+
export {
|
|
352
|
+
applyThemeClass,
|
|
353
|
+
createThemeProvider,
|
|
354
|
+
getSystemTheme,
|
|
355
|
+
type ThemeAttribute,
|
|
356
|
+
type ThemeProviderKit,
|
|
357
|
+
type ThemeProviderOptions,
|
|
358
|
+
type ThemeProviderProps,
|
|
359
|
+
type ThemeState,
|
|
360
|
+
} from "../app/src/theme/createThemeProvider";
|
|
361
|
+
export {
|
|
362
|
+
createPageTitleContext,
|
|
363
|
+
type DocumentTitleOptions,
|
|
364
|
+
type PageTitleContextKit,
|
|
365
|
+
type PageTitleContextOptions,
|
|
366
|
+
type PageTitleValue,
|
|
367
|
+
} from "../app/src/page-title/createPageTitleContext";
|
|
368
|
+
export {
|
|
369
|
+
PageMotionProvider,
|
|
370
|
+
useDisablePageMotion,
|
|
371
|
+
type PageMotionConfigProps,
|
|
372
|
+
type PageMotionProviderProps,
|
|
373
|
+
} from "../app/src/page-motion/PageMotionProvider";
|
|
374
|
+
export { formatCompactRelativeTime, type CompactRelativeTimeOptions } from "../app/src/time/compactRelativeTime";
|
|
375
|
+
export {
|
|
376
|
+
parseClientEnv,
|
|
377
|
+
VITE_ENV_NAMES,
|
|
378
|
+
type ClientEnv,
|
|
379
|
+
type ClientEnvOptions,
|
|
380
|
+
type ClientEnvSource,
|
|
381
|
+
type ClientEnvWithoutViteEnv,
|
|
382
|
+
type ViteEnvMode,
|
|
383
|
+
type ViteEnvName,
|
|
384
|
+
} from "../app/src/convex/env";
|
|
385
|
+
export { convexErrorMessage, userFacingErrorMessage } from "../app/src/convex/errorMessage";
|
|
386
|
+
export { useHeldResult } from "../app/src/convex/useHeldResult";
|
|
387
|
+
|
|
388
|
+
// Family app marks (Icon* components, deprecated AppMark and raw SVG strings for favicons).
|
|
389
|
+
export * from "./brand";
|
|
390
|
+
|
|
391
|
+
// Native tokens (JS values that match tokens.css).
|
|
392
|
+
export { tokens } from "../tokens/src/native";
|
|
393
|
+
export type { Tokens } from "../tokens/src/native";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
import { APP_ICONS, type AppName } from "../brand";
|
|
2
3
|
import { Button } from "../ui/button";
|
|
3
4
|
import { Separator } from "../ui/separator";
|
|
4
5
|
import { siteFooterClasses, type SiteFooterVariant } from "./marketing-classes";
|
|
@@ -10,6 +11,8 @@ export type SiteFooterLink = {
|
|
|
10
11
|
external?: boolean;
|
|
11
12
|
/** 20px round image before the label. */
|
|
12
13
|
image?: { src: string; alt: string };
|
|
14
|
+
/** 14px app glyph before the label, in `currentColor` and `aria-hidden`. Wins over `image`. */
|
|
15
|
+
app?: AppName;
|
|
13
16
|
};
|
|
14
17
|
|
|
15
18
|
export type SiteFooterSocial = {
|
|
@@ -78,25 +81,30 @@ export function SiteFooter({
|
|
|
78
81
|
<div key={column.heading} className="flex-1 sm:flex-none">
|
|
79
82
|
<h4 className={c.heading}>{column.heading}</h4>
|
|
80
83
|
<div className={c.links}>
|
|
81
|
-
{column.links.map((link) =>
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
{column.links.map((link) => {
|
|
85
|
+
const AppIcon = link.app ? APP_ICONS[link.app] : null;
|
|
86
|
+
return (
|
|
87
|
+
<a
|
|
88
|
+
key={link.label}
|
|
89
|
+
href={link.href}
|
|
90
|
+
{...(link.external ? { target: "_blank", rel: "noopener noreferrer" } : {})}
|
|
91
|
+
className={AppIcon || link.image ? c.imageLink : c.link}
|
|
92
|
+
>
|
|
93
|
+
{AppIcon ? (
|
|
94
|
+
<AppIcon size={14} />
|
|
95
|
+
) : link.image ? (
|
|
96
|
+
<img
|
|
97
|
+
src={link.image.src}
|
|
98
|
+
alt={link.image.alt}
|
|
99
|
+
width={20}
|
|
100
|
+
height={20}
|
|
101
|
+
className="rounded-full object-cover w-5 h-5 md:w-5 md:h-5"
|
|
102
|
+
/>
|
|
103
|
+
) : null}
|
|
104
|
+
{link.label}
|
|
105
|
+
</a>
|
|
106
|
+
);
|
|
107
|
+
})}
|
|
100
108
|
</div>
|
|
101
109
|
</div>
|
|
102
110
|
))}
|
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. The attribute stays after unmount. From 0.15.0 `tokens.css` (through `tokens/css/motion.css`) ships the `"off"` rules: `.ui-page-enter`, `.ui-enter`, `.ui-enter-up` and `.ui-stagger` fade only, `animate-in` / `animate-out`, `.t-modal` and `.t-tabs-pill` stop transitioning, and view transitions stop.
|
|
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,120 +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. From 0.16.3 `--field-radius` (`rounded-field`) is `min(var(--radius), 0.625rem)`, the same cap as `rounded-control` (was `1.25rem`). 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. From 0.15.0 it imports `clear-input.css`, `scrollbar-thin.css` and `motion.css`, sets the `--modal-*` and `--tabs-*` motion variables on `:root`, and defines `.glass-panel-strong` (`var(--overlay)`) and `.sidebar-section-label`. |
|
|
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-tabs` container (0.15.0), `.t-tab` with its press scale, 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). Imported by `tokens.css` from 0.15.0. |
|
|
18
|
-
| `@vvedantb/ui/tokens/css/clear-input.css` | `src/css/clear-input.css` | `ClearInput` layers (`.t-clear*`) and the `--clear-*` / `--glow-*` timings. Imported by `tokens.css`. From 0.15.1 the layers clip in `.t-clear-clip`, so `.t-clear` keeps the focus ring, and the placeholder layer only shows during `.is-clearing`. |
|
|
19
|
-
| `@vvedantb/ui/tokens/css/motion.css` | `src/css/motion.css` | `.ui-page-enter`, `.ui-enter`, `.ui-enter-up`, `.ui-stagger`, their keyframes and reduced-motion rules, and the `html[data-page-motion="off"]` overrides for `PageMotionProvider`. Imported by `tokens.css`. |
|
|
20
|
-
| `@vvedantb/ui/tokens/css/animations.css` | `src/css/animations.css` | `animate-aurora`, `animate-fade-in-up`, `animate-indeterminate` as `@theme` (CSS-first apps). |
|
|
21
|
-
| `@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` (both `min(var(--radius), 0.625rem)` from 0.16.3), the same three radius utilities as `tokens.css` and `.glass-panel-strong` (solid `--popover` from 0.15.0). Import it **or** `tokens.css`, never both. |
|
|
22
|
-
| `@vvedantb/ui/tokens/css/index.css` | `src/css/index.css` | base + dialog + modal + tabs + tabs-pills + utilities + animations + nav-icons, for new CSS-first apps (`tokens.css` brings scrollbar-thin). |
|
|
23
|
-
| `@vvedantb/ui/tokens/tailwind-preset` | `src/tailwind-preset.mjs` (+ `.d.mts`) | Tailwind preset for apps that load a JS config with `@config`. |
|
|
24
|
-
|
|
25
|
-
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.
|
|
26
|
-
|
|
27
|
-
## Use
|
|
28
|
-
|
|
29
|
-
CSS-first app (no `tailwind.config`):
|
|
30
|
-
|
|
31
|
-
```css
|
|
32
|
-
@import "tailwindcss";
|
|
33
|
-
@import "@vvedantb/ui/tokens";
|
|
34
|
-
@import "@vvedantb/ui/tokens/css/animations.css";
|
|
35
|
-
@import "@vvedantb/ui/tokens/css/base.css";
|
|
36
|
-
/* ...app @layer base rules... */
|
|
37
|
-
@import "@vvedantb/ui/tokens/css/modal.css";
|
|
38
|
-
@import "@vvedantb/ui/tokens/css/tabs.css";
|
|
39
|
-
/* ...app @layer components rules... */
|
|
40
|
-
/* no --modal-* / --tabs-* needed: tokens.css sets them */
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
App with a JS config (`@config "../tailwind.config.ts"`):
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
import { tokensPreset } from "@vvedantb/ui/tokens/tailwind-preset";
|
|
47
|
-
|
|
48
|
-
export default {
|
|
49
|
-
presets: [tokensPreset()],
|
|
50
|
-
// or tokensPreset({ color: (name) => `color-mix(in oklch, var(--${name}) calc(<alpha-value> * 100%), transparent)` })
|
|
51
|
-
content: ["./src/**/*.{ts,tsx}"],
|
|
52
|
-
theme: { extend: { /* app-only colours, fonts, animations */ } },
|
|
53
|
-
plugins: [tailwindcssAnimate],
|
|
54
|
-
};
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
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.
|
|
58
|
-
|
|
59
|
-
Do not import `css/animations.css` in an app that uses the preset: the preset already defines the same keyframes and animations.
|
|
60
|
-
|
|
61
|
-
### Where to put the imports
|
|
62
|
-
|
|
63
|
-
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.
|
|
64
|
-
|
|
65
|
-
### Variables each file needs
|
|
66
|
-
|
|
67
|
-
| File | Needs | Provided by |
|
|
68
|
-
| --- | --- | --- |
|
|
69
|
-
| `base.css` | `--accent`, `--foreground` | tokens.css or the app theme |
|
|
70
|
-
| `dialog.css` | none | |
|
|
71
|
-
| `modal.css` | `--modal-open-dur`, `--modal-close-dur`, `--modal-scale`, `--modal-scale-close`, `--modal-ease` | tokens.css (0.15.0), or app `:root` with the compat file |
|
|
72
|
-
| `tabs.css` | `--tabs-dur`, `--tabs-ease` (tokens.css, or app `:root` with the compat file); `--tabs-text-muted`, `--tabs-text-active`, `--tabs-pill-bg` | colours: tabs-pills.css or the app theme |
|
|
73
|
-
| `tabs-pills.css` | `--muted`, `--segment`, `--segment-foreground`, `--default` | tokens.css or the app theme |
|
|
74
|
-
| `utilities.css` | `--breakpoint-sm` (Tailwind default or app theme) | Tailwind |
|
|
75
|
-
| `scrollbar-thin.css` | `--scrollbar` | tokens.css or the app theme |
|
|
76
|
-
| `clear-input.css`, `motion.css` | none (own `:root` defaults) | |
|
|
77
|
-
| `animations.css` | none | |
|
|
78
|
-
| `tailwind-preset` | the CSS variables named in its colour map, `--radius`, `--field-radius` | tokens.css or the app theme |
|
|
79
|
-
|
|
80
|
-
### Using an existing shadcn RGB theme
|
|
81
|
-
|
|
82
|
-
See the package `README.md`. With the compat file, `base.css`, `scrollbar-thin.css`, `clear-input.css`, `motion.css`, `utilities.css`, `dialog.css`, `modal.css` and `tabs.css` need no `tokens.css` (`modal.css` and `tabs.css` then need the `--modal-*` / `--tabs-*` values on the app `:root`). `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.
|
|
83
|
-
|
|
84
|
-
### Parameters
|
|
85
|
-
|
|
86
|
-
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.
|
|
87
|
-
|
|
88
|
-
| File | Property | Default | Set by |
|
|
89
|
-
| --- | --- | --- | --- |
|
|
90
|
-
| `base.css` | `--tokens-control-transition-property` | `background-color, border-color, color, box-shadow, transform, opacity` | app-c: `background-color, color, transform, opacity` |
|
|
91
|
-
| `base.css` | `--tokens-control-transition-duration` | `240ms` | app-c: `100ms` |
|
|
92
|
-
|
|
93
|
-
From 0.15.0 the files that moved out of the apps take `:root` variables too. Every rule is in a Tailwind layer, so an app rule for the same selector (unlayered, or later in the same layer) also wins.
|
|
94
|
-
|
|
95
|
-
| File | Property | Default |
|
|
96
|
-
| --- | --- | --- |
|
|
97
|
-
| `tokens.css` | `--modal-open-dur`, `--modal-close-dur` | `180ms`, `120ms` |
|
|
98
|
-
| `tokens.css` | `--modal-scale`, `--modal-scale-close` | `0.96`, `0.96` |
|
|
99
|
-
| `tokens.css` | `--modal-ease`, `--tabs-ease` | `cubic-bezier(0.22, 1, 0.36, 1)` |
|
|
100
|
-
| `tokens.css` | `--tabs-dur` | `200ms` |
|
|
101
|
-
| `tokens.css` | `--sidebar-section-label-mix`, `--sidebar-section-label-hover-mix` | `55%`, `80%` (share of `--muted`) |
|
|
102
|
-
| `scrollbar-thin.css` | `--scrollbar-thin-rest`, `--scrollbar-thin-hover` | `40%`, `80%` (share of `--scrollbar`) |
|
|
103
|
-
| `clear-input.css` | `--clear-dur`, `--clear-out-dur`, `--clear-in-dur` | `1000ms`, `400ms`, `400ms` |
|
|
104
|
-
| `clear-input.css` | `--clear-out-fly`, `--clear-in-fly` | `12px`, `12px` |
|
|
105
|
-
| `clear-input.css` | `--clear-out-ease`, `--clear-in-ease` | `cubic-bezier(0.22, 1, 0.36, 1)` |
|
|
106
|
-
| `clear-input.css` | `--glow-delay`, `--glow-peak-at`, `--glow-opacity`, `--glow-spread` | `50ms`, `0.15`, `0.85`, `1.5` |
|
|
107
|
-
| `motion.css` | `--ui-enter-ease` | `cubic-bezier(0.22, 1, 0.36, 1)` |
|
|
108
|
-
| `motion.css` | `--ui-page-enter-dur`, `--ui-enter-dur`, `--ui-enter-up-dur` | `160ms`, `200ms`, `220ms` |
|
|
109
|
-
| `motion.css` | `--ui-stagger-step` | `40ms` (children 1 to 8) |
|
|
110
|
-
|
|
111
|
-
## Develop
|
|
112
|
-
|
|
113
|
-
```sh
|
|
114
|
-
pnpm --filter @vvedantb/ui build # export targets exist + tsc (primitives, shell, app)
|
|
115
|
-
pnpm --filter @vvedantb/ui test # vitest (app helpers) + offline node --test: exports, CSS structure, Tailwind compile, preset
|
|
116
|
-
pnpm --filter @vvedantb/ui analyze # rule-level duplication across the app clones -> verify/ANALYSIS.tables.md
|
|
117
|
-
pnpm --filter @vvedantb/ui verify # before/after compile of every app -> verify/RESULTS.md, examples/migration.md
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
`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.
|