@vvedantb/ui 0.8.0 → 0.10.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 +90 -2
- package/app/README.md +259 -0
- package/app/src/convex/ConvexClerkProvider.tsx +37 -0
- package/app/src/convex/env.ts +76 -0
- package/app/src/convex/useEnsureUser.ts +24 -0
- package/app/src/index.ts +17 -0
- package/package.json +22 -13
- package/shell/src/SidebarAccountMenu.tsx +78 -2
- package/shell/src/SidebarRail.tsx +20 -0
- package/shell/src/index.ts +2 -2
- package/src/index.ts +53 -3
- package/src/marketing/PricingModal.tsx +126 -0
- package/src/marketing/SiteFooter.tsx +135 -0
- package/src/marketing/createLandingKit.tsx +214 -0
- package/src/marketing/landing.css +271 -0
- package/src/marketing/landing.tsx +217 -0
- package/src/marketing/marketing-classes.ts +115 -0
- package/tokens/README.md +98 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// Class strings for the landing kit, `SiteFooter` and `PricingModal`, copied
|
|
2
|
+
// from the apps' markup. Some read the bare muted text colour the apps already
|
|
3
|
+
// ship (apps map `--color-muted` to the secondary text colour), so each such
|
|
4
|
+
// line carries the token check's allow marker. Every string is a literal so
|
|
5
|
+
// Tailwind's source scan sees it.
|
|
6
|
+
|
|
7
|
+
/** Centred landing column: `max-w-6xl` with responsive side padding. */
|
|
8
|
+
export const landingShellClass = "relative mx-auto w-full max-w-6xl px-5 sm:px-8 lg:px-10";
|
|
9
|
+
|
|
10
|
+
/** Bordered surface card used by landing product mocks. */
|
|
11
|
+
export const landingPanelClass = "overflow-hidden rounded-2xl border border-separator bg-surface";
|
|
12
|
+
|
|
13
|
+
/** Text link in `LandingFooter`, also for app links placed in its `actions` slot. */
|
|
14
|
+
export const landingFooterLinkClass = "max-sm:py-1 text-sm text-muted hover:text-foreground"; // check-tokens-allow: text-muted
|
|
15
|
+
|
|
16
|
+
/** `Button variant="link"` in `LandingFooter`'s `actions` slot (for example Sign in). */
|
|
17
|
+
export const landingFooterButtonClass = "h-auto p-0 text-sm text-muted hover:text-foreground"; // check-tokens-allow: text-muted
|
|
18
|
+
|
|
19
|
+
export const landingClasses = {
|
|
20
|
+
eyebrow:
|
|
21
|
+
"mb-3 font-mono text-[11px] font-medium uppercase tracking-[0.22em] text-muted sm:text-xs sm:tracking-[0.28em]", // check-tokens-allow: text-muted
|
|
22
|
+
sectionIntro:
|
|
23
|
+
"mt-4 max-w-xl text-pretty text-sm leading-relaxed text-muted sm:mt-5 sm:text-base", // check-tokens-allow: text-muted
|
|
24
|
+
featureDescription:
|
|
25
|
+
"mt-1 text-pretty text-xs leading-relaxed text-muted sm:text-[0.8125rem]", // check-tokens-allow: text-muted
|
|
26
|
+
navLink:
|
|
27
|
+
"inline-flex h-10 items-center rounded-lg px-3 text-sm text-muted transition-[color,background-color] duration-150 hover:bg-surface-tertiary hover:text-foreground", // check-tokens-allow: text-muted
|
|
28
|
+
heroEyebrow:
|
|
29
|
+
"mb-6 inline-flex items-center gap-2 rounded-full border border-separator bg-surface/70 px-3 py-1 text-xs text-muted", // check-tokens-allow: text-muted
|
|
30
|
+
heroDescription:
|
|
31
|
+
"mx-auto mt-5 max-w-xl text-pretty text-[0.9375rem] leading-relaxed text-muted sm:mt-6 sm:text-lg", // check-tokens-allow: text-muted
|
|
32
|
+
heroCapability:
|
|
33
|
+
"rounded-full border border-separator bg-surface/60 px-3 py-1 font-mono text-[11px] text-muted", // check-tokens-allow: text-muted
|
|
34
|
+
ctaDescription:
|
|
35
|
+
"mt-4 max-w-xl text-pretty text-sm leading-relaxed text-muted sm:text-base", // check-tokens-allow: text-muted
|
|
36
|
+
footerTagline:
|
|
37
|
+
"mt-3 max-w-sm text-pretty text-xs leading-relaxed text-muted", // check-tokens-allow: text-muted
|
|
38
|
+
footerGithub: "max-sm:py-1 text-muted hover:text-foreground", // check-tokens-allow: text-muted
|
|
39
|
+
} as const;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* `SiteFooter` class sets. `muted` and `muted-foreground` differ only in the
|
|
43
|
+
* secondary text colour; `touch` adds `max-sm:hit-target` targets and a
|
|
44
|
+
* safe-area bottom padding.
|
|
45
|
+
*/
|
|
46
|
+
export const siteFooterClasses = {
|
|
47
|
+
muted: {
|
|
48
|
+
footer: "bg-background text-foreground py-8 md:py-16 max-w-5xl mx-auto",
|
|
49
|
+
tagline: "text-sm text-muted mb-4 md:mb-6 max-w-sm", // check-tokens-allow: text-muted
|
|
50
|
+
socialButton:
|
|
51
|
+
"w-9 h-9 md:w-8 md:h-8 bg-default rounded-lg flex items-center justify-center hover:bg-surface-tertiary transition-[background-color]",
|
|
52
|
+
socialIcon: "w-4 h-4 text-muted", // check-tokens-allow: text-muted
|
|
53
|
+
heading: "font-thin tracking-wide mb-3 md:mb-4 text-muted", // check-tokens-allow: text-muted
|
|
54
|
+
links: "flex flex-col gap-2 md:gap-3 text-sm text-muted font-thin tracking-wide", // check-tokens-allow: text-muted
|
|
55
|
+
link: "hover:text-foreground transition-[color]",
|
|
56
|
+
imageLink: "hover:text-foreground transition-[color] flex flex-row items-center gap-2",
|
|
57
|
+
copyright: "text-xs md:text-sm text-muted", // check-tokens-allow: text-muted
|
|
58
|
+
rights: "text-xs md:text-sm text-muted/80", // check-tokens-allow: text-muted
|
|
59
|
+
legalLink:
|
|
60
|
+
"underline text-xs md:text-sm text-muted hover:text-foreground transition-[color]", // check-tokens-allow: text-muted
|
|
61
|
+
},
|
|
62
|
+
"muted-foreground": {
|
|
63
|
+
footer: "bg-background text-foreground py-8 md:py-16 max-w-5xl mx-auto",
|
|
64
|
+
tagline: "text-sm text-muted-foreground mb-4 md:mb-6 max-w-sm",
|
|
65
|
+
socialButton:
|
|
66
|
+
"w-9 h-9 md:w-8 md:h-8 bg-default rounded-lg flex items-center justify-center hover:bg-surface-tertiary transition-[background-color]",
|
|
67
|
+
socialIcon: "w-4 h-4 text-muted-foreground",
|
|
68
|
+
heading: "font-thin tracking-wide mb-3 md:mb-4 text-muted-foreground",
|
|
69
|
+
links: "flex flex-col gap-2 md:gap-3 text-sm text-muted-foreground font-thin tracking-wide",
|
|
70
|
+
link: "hover:text-foreground transition-[color]",
|
|
71
|
+
imageLink: "hover:text-foreground transition-[color] flex flex-row items-center gap-2",
|
|
72
|
+
copyright: "text-xs md:text-sm text-muted-foreground",
|
|
73
|
+
rights: "text-xs md:text-sm text-muted-foreground/80",
|
|
74
|
+
legalLink:
|
|
75
|
+
"underline text-xs md:text-sm text-muted-foreground hover:text-foreground transition-[color]",
|
|
76
|
+
},
|
|
77
|
+
touch: {
|
|
78
|
+
footer:
|
|
79
|
+
"mx-auto max-w-5xl bg-background pt-8 text-foreground pb-[max(2rem,env(safe-area-inset-bottom))] md:pt-16 md:pb-16",
|
|
80
|
+
tagline: "text-sm text-muted-foreground mb-4 md:mb-6 max-w-sm",
|
|
81
|
+
socialButton:
|
|
82
|
+
"max-sm:hit-target h-9 w-9 rounded-lg bg-default hover:bg-surface-tertiary md:h-8 md:w-8",
|
|
83
|
+
socialIcon: "h-4 w-4 text-muted-foreground",
|
|
84
|
+
heading: "font-thin tracking-wide mb-3 md:mb-4 text-muted-foreground",
|
|
85
|
+
links: "flex flex-col gap-2 text-sm font-thin tracking-wide text-muted-foreground md:gap-3",
|
|
86
|
+
link: "max-sm:hit-target max-sm:py-1 hover:text-foreground",
|
|
87
|
+
imageLink: "max-sm:hit-target flex flex-row items-center gap-2 max-sm:py-1 hover:text-foreground",
|
|
88
|
+
copyright: "text-xs md:text-sm text-muted-foreground",
|
|
89
|
+
rights: "text-xs md:text-sm text-muted-foreground/80",
|
|
90
|
+
legalLink:
|
|
91
|
+
"max-sm:hit-target text-xs underline text-muted-foreground hover:text-foreground md:text-sm",
|
|
92
|
+
},
|
|
93
|
+
} as const;
|
|
94
|
+
|
|
95
|
+
export type SiteFooterVariant = keyof typeof siteFooterClasses;
|
|
96
|
+
|
|
97
|
+
/** `PricingModal` class sets for the two secondary text colours. */
|
|
98
|
+
export const pricingModalClasses = {
|
|
99
|
+
muted: {
|
|
100
|
+
period: "pb-1 text-sm text-muted", // check-tokens-allow: text-muted
|
|
101
|
+
/** After `mt-4 max-w-[28ch]` and the optional font class. */
|
|
102
|
+
tagline: "text-lg italic leading-snug text-muted", // check-tokens-allow: text-muted
|
|
103
|
+
note: "mt-3 text-center text-xs text-muted", // check-tokens-allow: text-muted
|
|
104
|
+
featuresHeading:
|
|
105
|
+
"mb-4 text-[11px] font-medium uppercase tracking-[0.2em] text-muted", // check-tokens-allow: text-muted
|
|
106
|
+
},
|
|
107
|
+
"muted-foreground": {
|
|
108
|
+
period: "pb-1 text-sm text-muted-foreground",
|
|
109
|
+
tagline: "text-lg italic leading-snug text-muted-foreground",
|
|
110
|
+
note: "mt-3 text-center text-xs text-muted-foreground",
|
|
111
|
+
featuresHeading: "mb-4 text-[11px] font-medium uppercase tracking-[0.2em] text-muted-foreground",
|
|
112
|
+
},
|
|
113
|
+
} as const;
|
|
114
|
+
|
|
115
|
+
export type PricingModalTone = keyof typeof pricingModalClasses;
|
package/tokens/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
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.
|