@podoba/tailwind 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -0
  2. package/package.json +29 -0
  3. package/src/index.ts +131 -0
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # @podoba/tailwind
2
+
3
+ The shared Tailwind preset. Binds `@podoba/tokens` CSS custom properties to Tailwind's
4
+ `theme.extend`, so `@podoba/react` primitives (and your app code) can use utilities like
5
+ `bg-surface`, `text-fg-muted`, `text-heading2`, `rounded-panel`.
6
+
7
+ ```ts
8
+ // tailwind.config.ts in a consuming app
9
+ import podobaPreset from "@podoba/tailwind";
10
+
11
+ export default {
12
+ presets: [podobaPreset],
13
+ content: ["./src/**/*.{ts,tsx}"], // you own your content globs
14
+ };
15
+ ```
16
+
17
+ Also `import "@podoba/tokens/variables.css"` once at your app root so the `var(--…)`
18
+ the preset points at actually resolve.
19
+
20
+ The preset is intentionally **content-less** — a preset that hardcodes `content` globs
21
+ (as `@app/ui` did, pointing at `../../apps/web`) breaks every other consumer.
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@podoba/tailwind",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "podoba Tailwind preset — binds @podoba/tokens CSS custom properties to theme.extend.",
6
+ "main": "./src/index.ts",
7
+ "types": "./src/index.ts",
8
+ "exports": {
9
+ ".": "./src/index.ts"
10
+ },
11
+ "files": ["src"],
12
+ "publishConfig": {
13
+ "access": "public"
14
+ },
15
+ "scripts": {
16
+ "typecheck": "tsc --build"
17
+ },
18
+ "dependencies": {
19
+ "@tailwindcss/typography": "catalog:ui"
20
+ },
21
+ "peerDependencies": {
22
+ "tailwindcss": "^3.4.0"
23
+ },
24
+ "devDependencies": {
25
+ "tailwindcss": "catalog:ui",
26
+ "typescript": "catalog:",
27
+ "@types/bun": "catalog:"
28
+ }
29
+ }
package/src/index.ts ADDED
@@ -0,0 +1,131 @@
1
+ // @podoba/tailwind — shared Tailwind preset for the design system.
2
+ //
3
+ // Binds @podoba/tokens' CSS custom properties (see @podoba/tokens/variables.css)
4
+ // to Tailwind's theme, so primitives reference `bg-surface` / `text-fg-muted` /
5
+ // `text-heading2` / `rounded-panel` and resolve to `var(--…)`.
6
+ //
7
+ // Ported verbatim from @app/ui/tailwind.config.ts `theme.extend` + plugins.
8
+ // Deliberately CONTENT-LESS: a shared preset must not hardcode `content` globs
9
+ // (the source pointed at ../../apps/web). Each consuming app owns its `content`.
10
+ //
11
+ // import podobaPreset from "@podoba/tailwind";
12
+ // export default { presets: [podobaPreset], content: ["./src/**/*.{ts,tsx}"] };
13
+ //
14
+ // NOTE: custom scale keys here (fontSize `micro`…`display`/`heading1-5`, spacing
15
+ // `nav-x`, borderRadius `panel`) are mirrored in @podoba/react's uic tailwind-merge
16
+ // config so conflicting utilities dedupe correctly. Keep the two in sync.
17
+
18
+ import typography from "@tailwindcss/typography";
19
+ import type { Config } from "tailwindcss";
20
+
21
+ export const podobaPreset: Omit<Config, "content"> = {
22
+ theme: {
23
+ extend: {
24
+ colors: {
25
+ brand: {
26
+ DEFAULT: "var(--color-brand-primary)",
27
+ primary: "var(--color-brand-primary)",
28
+ secondary: "var(--color-brand-secondary)",
29
+ green: "var(--color-brand-green)",
30
+ },
31
+ surface: {
32
+ DEFAULT: "var(--color-surface)",
33
+ muted: "var(--color-surface-muted)",
34
+ card: "var(--color-surface-card)",
35
+ inverted: "var(--color-surface-inverted)",
36
+ placeholder: "var(--color-surface-placeholder)",
37
+ },
38
+ fg: {
39
+ DEFAULT: "var(--color-fg)",
40
+ muted: "var(--color-fg-muted)",
41
+ subtle: "var(--color-fg-subtle)",
42
+ inverted: "var(--color-fg-inverted)",
43
+ },
44
+ accent: {
45
+ strong: "var(--color-accent-strong)",
46
+ yellow: "var(--color-accent-yellow)",
47
+ mint: "var(--color-accent-mint)",
48
+ "green-light": "var(--color-accent-green-light)",
49
+ pink: "var(--color-accent-pink)",
50
+ },
51
+ neutral: {
52
+ 600: "var(--color-neutral-600)",
53
+ },
54
+ border: {
55
+ DEFAULT: "var(--color-border)",
56
+ },
57
+ danger: {
58
+ DEFAULT: "var(--color-danger)",
59
+ fg: "var(--color-danger-fg)",
60
+ },
61
+ success: {
62
+ DEFAULT: "var(--color-success)",
63
+ fg: "var(--color-success-fg)",
64
+ },
65
+ ring: {
66
+ DEFAULT: "var(--color-ring)",
67
+ },
68
+ },
69
+ borderRadius: {
70
+ sm: "var(--radius-sm)",
71
+ md: "var(--radius-md)",
72
+ lg: "var(--radius-lg)",
73
+ xl: "var(--radius-xl)",
74
+ "2xl": "var(--radius-2xl)",
75
+ panel: "var(--radius-panel)",
76
+ },
77
+ spacing: {
78
+ xs: "var(--space-xs)",
79
+ sm: "var(--space-sm)",
80
+ md: "var(--space-md)",
81
+ lg: "var(--space-lg)",
82
+ xl: "var(--space-xl)",
83
+ "nav-x": "var(--space-nav-x)",
84
+ },
85
+ fontFamily: {
86
+ sans: "var(--font-sans)",
87
+ mono: "var(--font-mono)",
88
+ },
89
+ fontSize: {
90
+ micro: "var(--font-size-micro)",
91
+ caption: "var(--font-size-caption)",
92
+ label: "var(--font-size-label)",
93
+ compact: "var(--font-size-compact)",
94
+ callout: "var(--font-size-callout)",
95
+ body: "var(--font-size-body)",
96
+ subtitle: "var(--font-size-subtitle)",
97
+ title: "var(--font-size-title)",
98
+ headline: "var(--font-size-headline)",
99
+ display: "var(--font-size-display)",
100
+ heading1: ["var(--font-size-heading1)", { lineHeight: "var(--line-height-heading1)" }],
101
+ heading2: ["var(--font-size-heading2)", { lineHeight: "var(--line-height-heading2)" }],
102
+ heading3: ["var(--font-size-heading3)", { lineHeight: "var(--line-height-heading3)" }],
103
+ heading4: ["var(--font-size-heading4)", { lineHeight: "var(--line-height-heading4)" }],
104
+ heading5: ["var(--font-size-heading5)", { lineHeight: "var(--line-height-heading5)" }],
105
+ },
106
+ letterSpacing: {
107
+ tight: "var(--tracking-tight)",
108
+ normal: "var(--tracking-normal)",
109
+ wide: "var(--tracking-wide)",
110
+ wider: "var(--tracking-wider)",
111
+ },
112
+ keyframes: {
113
+ "expand-cta": {
114
+ from: { opacity: "0", transform: "translateY(-2px)" },
115
+ to: { opacity: "1", transform: "translateY(0)" },
116
+ },
117
+ "lightbox-in": {
118
+ from: { opacity: "0", transform: "translateX(24%)" },
119
+ to: { opacity: "1", transform: "translateX(0)" },
120
+ },
121
+ },
122
+ animation: {
123
+ "expand-cta": "expand-cta 220ms cubic-bezier(0.16, 1, 0.3, 1)",
124
+ "lightbox-in": "lightbox-in 0.3s ease-out",
125
+ },
126
+ },
127
+ },
128
+ plugins: [typography],
129
+ };
130
+
131
+ export default podobaPreset;