@posthog/quill-tokens 0.1.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,25 @@
1
+ Copyright (c) 2020-2025 PostHog Inc.
2
+
3
+ Portions of this software are licensed as follows:
4
+
5
+ * All content that resides under the "ee/" directory of this repository, if that directory exists, is licensed under the license defined in "ee/LICENSE".
6
+ * All third party components incorporated into the PostHog Software are licensed under the original license provided by the owner of the applicable component.
7
+ * Content outside of the above mentioned directories or restrictions above is available under the "MIT Expat" license as defined below.
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
@@ -0,0 +1,17 @@
1
+ /**
2
+ * PostHog Design System — Border Radius Tokens
3
+ *
4
+ * Note: Tailwind v4 uses --radius as a base value in color-system.css (0.625rem).
5
+ * These are the static design-token values for direct use.
6
+ * The @theme block in styles.css derives --radius-* from the base --radius var.
7
+ */
8
+ export declare const borderRadius: {
9
+ readonly none: "0px";
10
+ readonly sm: "4px";
11
+ readonly md: "6px";
12
+ readonly lg: "8px";
13
+ readonly xl: "12px";
14
+ readonly full: "9999px";
15
+ };
16
+ export type BorderRadius = typeof borderRadius;
17
+ //# sourceMappingURL=border-radius.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"border-radius.d.ts","sourceRoot":"","sources":["../src/border-radius.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAA"}
@@ -0,0 +1,75 @@
1
+ /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
+
3
+ :root {
4
+ color-scheme: light;
5
+ }
6
+
7
+ .dark {
8
+ color-scheme: dark;
9
+ }
10
+
11
+ :root {
12
+ --radius: 0.625rem;
13
+ --background: oklch(0.97 0.006 106);
14
+ --foreground: oklch(0.13 0.028 262);
15
+ --card: oklch(1 0 0);
16
+ --card-foreground: oklch(0.13 0.028 262);
17
+ --popover: oklch(1 0 0);
18
+ --popover-foreground: oklch(0.13 0.028 262);
19
+ --primary: oklch(0.6514 0.2137 37.89);
20
+ --primary-foreground: oklch(1 0 0);
21
+ --secondary: oklch(0.31 0 0);
22
+ --secondary-foreground: oklch(1 0 0);
23
+ --muted: oklch(0.97 0.006 106);
24
+ --muted-foreground: oklch(0.446 0.03 257);
25
+ --accent: oklch(0.923 0.003 49);
26
+ --accent-foreground: oklch(0.13 0.028 262);
27
+ --destructive: oklch(0.92 0.03 32.22);
28
+ --destructive-foreground: oklch(0.59 0.2 23.61);
29
+ --success: oklch(0.94 0.06 154.03);
30
+ --success-foreground: oklch(0.448 0.119 151.328);
31
+ --warning: oklch(0.93 0.04 74.41);
32
+ --warning-foreground: oklch(0.476 0.114 61.907);
33
+ --info: oklch(0.882 0.059 254.128);
34
+ --info-foreground: oklab(0.49 -0.02 -0.24);
35
+ --border: oklch(0.923 0.003 49);
36
+ --input: oklch(0.81 0 0 / 1);
37
+ --ring: oklch(0.446 0.03 257);
38
+ --fill-hover: color-mix(in oklch, var(--accent) 40%, transparent);
39
+ --fill-active: var(--accent);
40
+ --fill-expanded: var(--muted);
41
+ --fill-selected: color-mix(in oklch, var(--fill-hover) 50%, transparent);
42
+ }
43
+
44
+ .dark {
45
+ --radius: 0.625rem;
46
+ --background: hsl(240 8% 8%);
47
+ --foreground: oklch(0.967 0.003 265);
48
+ --card: hsl(235 8% 15%);
49
+ --card-foreground: oklch(0.967 0.003 265);
50
+ --popover: hsl(235 8% 15%);
51
+ --popover-foreground: oklch(0.967 0.003 265);
52
+ --primary: oklch(0.8325 0.1611 84.54);
53
+ --primary-foreground: oklch(0.13 0.028 262);
54
+ --secondary: oklch(0.86 0 0);
55
+ --secondary-foreground: oklch(0.13 0.028 262);
56
+ --muted: hsl(240 8% 10%);
57
+ --muted-foreground: oklch(0.709 0 0);
58
+ --accent: hsl(230 8% 20%);
59
+ --accent-foreground: oklch(0.967 0.003 265);
60
+ --destructive: oklch(0.24 0.03 2.79);
61
+ --destructive-foreground: oklch(0.6316 0.1927 24.53);
62
+ --success: oklch(0.27 0.04 157.6);
63
+ --success-foreground: oklch(0.925 0.084 155.995);
64
+ --warning: oklab(0.29 0.03 0.05);
65
+ --warning-foreground: oklch(0.77 0.14 99.29);
66
+ --info: oklch(0.4242 0.1982 265.5 / 40%);
67
+ --info-foreground: oklch(0.882 0.059 254.128);
68
+ --border: hsl(230 8% 20%);
69
+ --input: oklch(0.46 0.02 279.18);
70
+ --ring: oklch(0.709 0 0);
71
+ --fill-hover: color-mix(in oklch, var(--accent) 40%, transparent);
72
+ --fill-active: var(--accent);
73
+ --fill-expanded: var(--muted);
74
+ --fill-selected: color-mix(in oklch, var(--accent) 50%, transparent);
75
+ }
@@ -0,0 +1,32 @@
1
+ /**
2
+ * PostHog Design System — Color Tokens (shadcn-aligned)
3
+ *
4
+ * Each value is [light, dark]. Index 0 = light, index 1 = dark.
5
+ */
6
+ export declare const semanticColors: Record<string, ColorTuple>;
7
+ export type SemanticColorKey = keyof typeof semanticColors;
8
+ export type ColorTuple = readonly [light: string, dark: string, tailwindClass: string];
9
+ export interface StylesConfig {
10
+ /** Include @layer base reset rules (apps only) */
11
+ includeBaseLayer?: boolean;
12
+ }
13
+ /** Flat object for one theme */
14
+ export declare function resolveTheme(mode: 'light' | 'dark'): Record<SemanticColorKey, string>;
15
+ /** Generate color-system.css (:root light + .dark overrides) */
16
+ export declare function generateColorSystemCSS(): string;
17
+ /**
18
+ * Generate Tailwind v4 @theme + @custom-variant + optional @layer base.
19
+ *
20
+ * Does NOT include `@import "tailwindcss"` or `@import "color-system.css"` —
21
+ * those are the consuming app's responsibility (they must resolve from the
22
+ * app's node_modules, not from tokens/dist/).
23
+ *
24
+ * Two modes:
25
+ * - **Library** (includeBaseLayer: false): Just the @theme inline block
26
+ * so Tailwind can generate utility classes. Used by packages.
27
+ *
28
+ * - **App** (includeBaseLayer: true): @theme + base layer resets.
29
+ * Used by apps/web, apps/storybook.
30
+ */
31
+ export declare function generateStylesCSS(config?: StylesConfig): string;
32
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAsD5C,CAAA;AAIV,MAAM,MAAM,gBAAgB,GAAG,MAAM,OAAO,cAAc,CAAA;AAC1D,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAA;AAItF,MAAM,WAAW,YAAY;IACzB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAC7B;AAID,gCAAgC;AAChC,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAMrF;AAED,gEAAgE;AAChE,wBAAgB,sBAAsB,IAAI,MAAM,CAoB/C;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,YAAiB,GAAG,MAAM,CAgFnE"}
package/dist/css.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Shared CSS generation helpers for token files.
3
+ */
4
+ /** Generate CSS custom property lines from a flat key-value map */
5
+ export declare function cssVars(tokens: Record<string, string>, prefix: string, indent?: string): string;
6
+ /** Generate CSS custom property lines without a prefix */
7
+ export declare function cssVarsFlat(tokens: Record<string, string>, indent?: string): string;
8
+ /** Quote a font name if it contains spaces, otherwise return as-is */
9
+ export declare function quoteFontName(name: string): string;
10
+ /** Format a font family array as a CSS value */
11
+ export declare function fontFamilyValue(fonts: readonly string[]): string;
12
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../src/css.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,mEAAmE;AACnE,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAO,GAAG,MAAM,CAI7F;AAED,0DAA0D;AAC1D,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,SAAO,GAAG,MAAM,CAIjF;AAED,sEAAsE;AACtE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,gDAAgD;AAChD,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAEhE"}
package/dist/index.cjs ADDED
@@ -0,0 +1,24 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(o,s,e=" "){return Object.entries(o).map(([n,a])=>`${e}--${s}-${n}: ${a};`).join(`
2
+ `)}function u(o,s=" "){return Object.entries(o).map(([e,n])=>`${s}--${e}: ${n};`).join(`
3
+ `)}function c(o){return/\s/.test(o)?`"${o}"`:o}function i(o){return o.map(c).join(", ")}const p={sm:"0 1px 2px 0 rgba(0, 0, 0, 0.3)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3)"};function x(){return l(p,"shadow")}const h={0:"0px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",8:"32px",10:"40px",12:"48px",16:"64px"};function m(){return l(h,"spacing")}const k=16;function r(o){return`${o/k}rem`}const d={xxs:[r(10),{lineHeight:r(12)}],xs:[r(12),{lineHeight:r(16)}],sm:[r(14),{lineHeight:r(20)}],base:[r(16),{lineHeight:r(24)}],lg:[r(18),{lineHeight:r(28)}],xl:[r(20),{lineHeight:r(28)}],"2xl":[r(24),{lineHeight:r(32)}]},g={sans:["-apple-system","BlinkMacSystemFont","Inter","Segoe UI","Roboto","Helvetica Neue","sans-serif"],mono:["JetBrains Mono","Fira Code","monospace"]};function b(){return Object.entries(d).map(([o,[s,{lineHeight:e}]])=>` --text-${o}: ${s};
4
+ --text-${o}--line-height: ${e};`).join(`
5
+ `)}function v(){return Object.entries(g).map(([o,s])=>` --font-${o}: ${i(s)};`).join(`
6
+ `)}const t={background:["oklch(0.97 0.006 106)","hsl(240 8% 8%)","bg-background"],foreground:["oklch(0.13 0.028 262)","oklch(0.967 0.003 265)","text-foreground"],card:["oklch(1 0 0)","hsl(235 8% 15%)","bg-card"],"card-foreground":["oklch(0.13 0.028 262)","oklch(0.967 0.003 265)","text-card-foreground"],popover:["oklch(1 0 0)","hsl(235 8% 15%)","bg-popover"],"popover-foreground":["oklch(0.13 0.028 262)","oklch(0.967 0.003 265)","text-popover-foreground"],primary:["oklch(0.6514 0.2137 37.89)","oklch(0.8325 0.1611 84.54)","bg-primary"],"primary-foreground":["oklch(1 0 0)","oklch(0.13 0.028 262)","text-primary-foreground"],secondary:["oklch(0.31 0 0)","oklch(0.86 0 0)","bg-secondary"],"secondary-foreground":["oklch(1 0 0)","oklch(0.13 0.028 262)","text-secondary-foreground"],muted:["oklch(0.97 0.006 106)","hsl(240 8% 10%)","bg-muted"],"muted-foreground":["oklch(0.446 0.03 257)","oklch(0.709 0 0)","text-muted-foreground"],accent:["oklch(0.923 0.003 49)","hsl(230 8% 20%)","bg-accent"],"accent-foreground":["oklch(0.13 0.028 262)","oklch(0.967 0.003 265)","text-accent-foreground"],destructive:["oklch(0.92 0.03 32.22)","oklch(0.24 0.03 2.79)","bg-destructive"],"destructive-foreground":["oklch(0.59 0.2 23.61)","oklch(0.6316 0.1927 24.53)","text-destructive-foreground"],success:["oklch(0.94 0.06 154.03)","oklch(0.27 0.04 157.6)","bg-success"],"success-foreground":["oklch(0.448 0.119 151.328)","oklch(0.925 0.084 155.995)","text-success-foreground"],warning:["oklch(0.93 0.04 74.41)","oklab(0.29 0.03 0.05)","bg-warning"],"warning-foreground":["oklch(0.476 0.114 61.907)","oklch(0.77 0.14 99.29)","text-warning-foreground"],info:["oklch(0.882 0.059 254.128)","oklch(0.4242 0.1982 265.5 / 40%)","bg-info"],"info-foreground":["oklab(0.49 -0.02 -0.24)","oklch(0.882 0.059 254.128)","text-info-foreground"],border:["oklch(0.923 0.003 49)","hsl(230 8% 20%)","border-border"],input:["oklch(0.81 0 0 / 1)","oklch(0.46 0.02 279.18)","border-input"],ring:["oklch(0.446 0.03 257)","oklch(0.709 0 0)","border-ring"],"fill-hover":["color-mix(in oklch, var(--accent) 40%, transparent)","color-mix(in oklch, var(--accent) 40%, transparent)","bg-fill-hover"],"fill-active":["var(--accent)","var(--accent)","bg-fill-active"],"fill-expanded":["var(--muted)","var(--muted)","bg-fill-expanded"],"fill-selected":["color-mix(in oklch, var(--fill-hover) 50%, transparent)","color-mix(in oklch, var(--accent) 50%, transparent)","bg-fill-selected"]};function y(o){const s=o==="light"?0:1;return Object.fromEntries(Object.entries(t).map(([e,n])=>[e,n[s]]))}function S(){const o=(s,e)=>{const n=Object.fromEntries(Object.entries(t).map(([a,f])=>[a,f[e]]));return`${s} {
7
+ --radius: 0.625rem;
8
+ ${u(n)}
9
+ }`};return`/* Auto-generated by @posthog/quill-tokens — do not edit manually */
10
+
11
+ :root {
12
+ color-scheme: light;
13
+ }
14
+
15
+ .dark {
16
+ color-scheme: dark;
17
+ }
18
+
19
+ ${o(":root",0)}
20
+
21
+ ${o(".dark",1)}
22
+ `}function $(){return Object.keys(t).map(o=>` --color-${o}: var(--${o});`).join(`
23
+ `)}function j(o={}){const{includeBaseLayer:s=!1}=o,e=["/* Auto-generated by @posthog/quill-tokens — do not edit manually */","","@custom-variant dark (&:is(.dark, .dark *));"];return e.push(""),e.push("@theme inline {"),e.push(" --animate-skeleton: skeleton 2s -1s infinite linear;"),e.push(" --animate-pulse-glow: pulse-glow 2s -1s infinite linear;"),e.push(" --animate-horizontal-shake: horizontal-shake 0.3s ease-out;"),e.push(" --animate-radar: radar 2s ease-out infinite;"),e.push(""),e.push(" /* --- Colors --- */"),e.push($()),e.push(""),e.push(" /* --- Spacing --- */"),e.push(m()),e.push(""),e.push(" /* --- Font sizes --- */"),e.push(b()),e.push(""),e.push(" /* --- Font families --- */"),e.push(v()),e.push(""),e.push(" /* --- Shadows --- */"),e.push(x()),e.push(""),e.push(" /* --- Radius (derived from --radius base) --- */"),e.push(" --radius-sm: calc(var(--radius) - 4px);"),e.push(" --radius-md: calc(var(--radius) - 2px);"),e.push(" --radius-lg: var(--radius);"),e.push(" --radius-xl: calc(var(--radius) + 4px);"),e.push(" --radius-2xl: calc(var(--radius) + 8px);"),e.push(" --radius-3xl: calc(var(--radius) + 12px);"),e.push(" --radius-4xl: calc(var(--radius) + 16px);"),e.push(""),e.push(" @keyframes skeleton {"),e.push(" to {"),e.push(" background-position: -200% 0;"),e.push(" }"),e.push(" }"),e.push(""),e.push(" @keyframes pulse-glow {"),e.push(" 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }"),e.push(" 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }"),e.push(" }"),e.push(""),e.push(" @keyframes horizontal-shake {"),e.push(" 0% { transform: translateX(0); }"),e.push(" 25% { transform: translateX(5px); }"),e.push(" 50% { transform: translateX(-5px); }"),e.push(" 75% { transform: translateX(2px); }"),e.push(" 100% { transform: translateX(0); }"),e.push(" }"),e.push(""),e.push(" @keyframes radar {"),e.push(" 0% { transform: scale(1); opacity: 0.5; }"),e.push(" 100% { transform: scale(1.5); opacity: 0; }"),e.push(" }"),e.push("}"),s&&(e.push(""),e.push("@layer base {"),e.push(" * {"),e.push(" @apply border-border outline-ring/50;"),e.push(" }"),e.push(" body {"),e.push(" @apply bg-background text-foreground;"),e.push(" }"),e.push("}")),e.push(""),e.join(`
24
+ `)}const w={none:"0px",sm:"4px",md:"6px",lg:"8px",xl:"12px",full:"9999px"};exports.borderRadius=w;exports.cssVars=l;exports.cssVarsFlat=u;exports.fontFamily=g;exports.fontFamilyValue=i;exports.fontSize=d;exports.generateColorSystemCSS=S;exports.generateStylesCSS=j;exports.quoteFontName=c;exports.resolveTheme=y;exports.semanticColors=t;exports.shadow=p;exports.spacing=h;
@@ -0,0 +1,12 @@
1
+ export { semanticColors, resolveTheme, generateColorSystemCSS, generateStylesCSS } from './colors';
2
+ export type { SemanticColorKey, ColorTuple, StylesConfig } from './colors';
3
+ export { spacing } from './spacing';
4
+ export type { Spacing } from './spacing';
5
+ export { fontSize, fontFamily } from './typography';
6
+ export type { FontSize, FontFamily } from './typography';
7
+ export { borderRadius } from './border-radius';
8
+ export type { BorderRadius } from './border-radius';
9
+ export { shadow } from './shadow';
10
+ export type { Shadow } from './shadow';
11
+ export { cssVars, cssVarsFlat, quoteFontName, fontFamilyValue } from './css';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAClG,YAAY,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAG1E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,YAAY,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAGxC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACnD,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAGxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAGnD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGtC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,OAAO,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,176 @@
1
+ function u(o, n, e = " ") {
2
+ return Object.entries(o).map(([s, t]) => `${e}--${n}-${s}: ${t};`).join(`
3
+ `);
4
+ }
5
+ function l(o, n = " ") {
6
+ return Object.entries(o).map(([e, s]) => `${n}--${e}: ${s};`).join(`
7
+ `);
8
+ }
9
+ function p(o) {
10
+ return /\s/.test(o) ? `"${o}"` : o;
11
+ }
12
+ function i(o) {
13
+ return o.map(p).join(", ");
14
+ }
15
+ const h = {
16
+ sm: "0 1px 2px 0 rgba(0, 0, 0, 0.3)",
17
+ md: "0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3)",
18
+ lg: "0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3)"
19
+ };
20
+ function d() {
21
+ return u(h, "shadow");
22
+ }
23
+ const g = {
24
+ 0: "0px",
25
+ 1: "4px",
26
+ 2: "8px",
27
+ 3: "12px",
28
+ 4: "16px",
29
+ 5: "20px",
30
+ 6: "24px",
31
+ 8: "32px",
32
+ 10: "40px",
33
+ 12: "48px",
34
+ 16: "64px"
35
+ };
36
+ function x() {
37
+ return u(g, "spacing");
38
+ }
39
+ const f = 16;
40
+ function r(o) {
41
+ return `${o / f}rem`;
42
+ }
43
+ const k = {
44
+ xxs: [r(10), { lineHeight: r(12) }],
45
+ // 0.625rem (10px), 0.75rem (12px)
46
+ xs: [r(12), { lineHeight: r(16) }],
47
+ // 0.75rem (12px), 1rem (16px)
48
+ sm: [r(14), { lineHeight: r(20) }],
49
+ // 0.875rem (14px), 1.25rem (20px)
50
+ base: [r(16), { lineHeight: r(24) }],
51
+ // 1rem (16px), 1.5rem (24px)
52
+ lg: [r(18), { lineHeight: r(28) }],
53
+ // 1.125rem (18px), 1.75rem (28px)
54
+ xl: [r(20), { lineHeight: r(28) }],
55
+ // 1.25rem (20px), 1.75rem (28px)
56
+ "2xl": [r(24), { lineHeight: r(32) }]
57
+ // 1.5rem (24px), 2rem (32px)
58
+ }, m = {
59
+ sans: ["-apple-system", "BlinkMacSystemFont", "Inter", "Segoe UI", "Roboto", "Helvetica Neue", "sans-serif"],
60
+ mono: ["JetBrains Mono", "Fira Code", "monospace"]
61
+ };
62
+ function b() {
63
+ return Object.entries(k).map(([o, [n, { lineHeight: e }]]) => ` --text-${o}: ${n};
64
+ --text-${o}--line-height: ${e};`).join(`
65
+ `);
66
+ }
67
+ function v() {
68
+ return Object.entries(m).map(([o, n]) => ` --font-${o}: ${i(n)};`).join(`
69
+ `);
70
+ }
71
+ const a = {
72
+ background: ["oklch(0.97 0.006 106)", "hsl(240 8% 8%)", "bg-background"],
73
+ foreground: ["oklch(0.13 0.028 262)", "oklch(0.967 0.003 265)", "text-foreground"],
74
+ card: ["oklch(1 0 0)", "hsl(235 8% 15%)", "bg-card"],
75
+ "card-foreground": ["oklch(0.13 0.028 262)", "oklch(0.967 0.003 265)", "text-card-foreground"],
76
+ popover: ["oklch(1 0 0)", "hsl(235 8% 15%)", "bg-popover"],
77
+ "popover-foreground": ["oklch(0.13 0.028 262)", "oklch(0.967 0.003 265)", "text-popover-foreground"],
78
+ primary: ["oklch(0.6514 0.2137 37.89)", "oklch(0.8325 0.1611 84.54)", "bg-primary"],
79
+ "primary-foreground": ["oklch(1 0 0)", "oklch(0.13 0.028 262)", "text-primary-foreground"],
80
+ secondary: ["oklch(0.31 0 0)", "oklch(0.86 0 0)", "bg-secondary"],
81
+ "secondary-foreground": ["oklch(1 0 0)", "oklch(0.13 0.028 262)", "text-secondary-foreground"],
82
+ muted: ["oklch(0.97 0.006 106)", "hsl(240 8% 10%)", "bg-muted"],
83
+ "muted-foreground": ["oklch(0.446 0.03 257)", "oklch(0.709 0 0)", "text-muted-foreground"],
84
+ accent: ["oklch(0.923 0.003 49)", "hsl(230 8% 20%)", "bg-accent"],
85
+ "accent-foreground": ["oklch(0.13 0.028 262)", "oklch(0.967 0.003 265)", "text-accent-foreground"],
86
+ destructive: ["oklch(0.92 0.03 32.22)", "oklch(0.24 0.03 2.79)", "bg-destructive"],
87
+ "destructive-foreground": ["oklch(0.59 0.2 23.61)", "oklch(0.6316 0.1927 24.53)", "text-destructive-foreground"],
88
+ success: ["oklch(0.94 0.06 154.03)", "oklch(0.27 0.04 157.6)", "bg-success"],
89
+ "success-foreground": ["oklch(0.448 0.119 151.328)", "oklch(0.925 0.084 155.995)", "text-success-foreground"],
90
+ warning: ["oklch(0.93 0.04 74.41)", "oklab(0.29 0.03 0.05)", "bg-warning"],
91
+ "warning-foreground": ["oklch(0.476 0.114 61.907)", "oklch(0.77 0.14 99.29)", "text-warning-foreground"],
92
+ info: ["oklch(0.882 0.059 254.128)", "oklch(0.4242 0.1982 265.5 / 40%)", "bg-info"],
93
+ "info-foreground": ["oklab(0.49 -0.02 -0.24)", "oklch(0.882 0.059 254.128)", "text-info-foreground"],
94
+ border: ["oklch(0.923 0.003 49)", "hsl(230 8% 20%)", "border-border"],
95
+ input: ["oklch(0.81 0 0 / 1)", "oklch(0.46 0.02 279.18)", "border-input"],
96
+ ring: ["oklch(0.446 0.03 257)", "oklch(0.709 0 0)", "border-ring"],
97
+ // Hovering default button
98
+ "fill-hover": [
99
+ "color-mix(in oklch, var(--accent) 40%, transparent)",
100
+ "color-mix(in oklch, var(--accent) 40%, transparent)",
101
+ "bg-fill-hover"
102
+ ],
103
+ // Active default button
104
+ "fill-active": ["var(--accent)", "var(--accent)", "bg-fill-active"],
105
+ // Expanded default button
106
+ "fill-expanded": ["var(--muted)", "var(--muted)", "bg-fill-expanded"],
107
+ // Selected default button (checked or selected)
108
+ "fill-selected": [
109
+ "color-mix(in oklch, var(--fill-hover) 50%, transparent)",
110
+ "color-mix(in oklch, var(--accent) 50%, transparent)",
111
+ "bg-fill-selected"
112
+ ]
113
+ };
114
+ function S(o) {
115
+ const n = o === "light" ? 0 : 1;
116
+ return Object.fromEntries(Object.entries(a).map(([e, s]) => [e, s[n]]));
117
+ }
118
+ function $() {
119
+ const o = (n, e) => {
120
+ const s = Object.fromEntries(Object.entries(a).map(([t, c]) => [t, c[e]]));
121
+ return `${n} {
122
+ --radius: 0.625rem;
123
+ ${l(s)}
124
+ }`;
125
+ };
126
+ return `/* Auto-generated by @posthog/quill-tokens — do not edit manually */
127
+
128
+ :root {
129
+ color-scheme: light;
130
+ }
131
+
132
+ .dark {
133
+ color-scheme: dark;
134
+ }
135
+
136
+ ${o(":root", 0)}
137
+
138
+ ${o(".dark", 1)}
139
+ `;
140
+ }
141
+ function y() {
142
+ return Object.keys(a).map((o) => ` --color-${o}: var(--${o});`).join(`
143
+ `);
144
+ }
145
+ function j(o = {}) {
146
+ const { includeBaseLayer: n = !1 } = o, e = [
147
+ "/* Auto-generated by @posthog/quill-tokens — do not edit manually */",
148
+ "",
149
+ "@custom-variant dark (&:is(.dark, .dark *));"
150
+ ];
151
+ return e.push(""), e.push("@theme inline {"), e.push(" --animate-skeleton: skeleton 2s -1s infinite linear;"), e.push(" --animate-pulse-glow: pulse-glow 2s -1s infinite linear;"), e.push(" --animate-horizontal-shake: horizontal-shake 0.3s ease-out;"), e.push(" --animate-radar: radar 2s ease-out infinite;"), e.push(""), e.push(" /* --- Colors --- */"), e.push(y()), e.push(""), e.push(" /* --- Spacing --- */"), e.push(x()), e.push(""), e.push(" /* --- Font sizes --- */"), e.push(b()), e.push(""), e.push(" /* --- Font families --- */"), e.push(v()), e.push(""), e.push(" /* --- Shadows --- */"), e.push(d()), e.push(""), e.push(" /* --- Radius (derived from --radius base) --- */"), e.push(" --radius-sm: calc(var(--radius) - 4px);"), e.push(" --radius-md: calc(var(--radius) - 2px);"), e.push(" --radius-lg: var(--radius);"), e.push(" --radius-xl: calc(var(--radius) + 4px);"), e.push(" --radius-2xl: calc(var(--radius) + 8px);"), e.push(" --radius-3xl: calc(var(--radius) + 12px);"), e.push(" --radius-4xl: calc(var(--radius) + 16px);"), e.push(""), e.push(" @keyframes skeleton {"), e.push(" to {"), e.push(" background-position: -200% 0;"), e.push(" }"), e.push(" }"), e.push(""), e.push(" @keyframes pulse-glow {"), e.push(" 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }"), e.push(" 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }"), e.push(" }"), e.push(""), e.push(" @keyframes horizontal-shake {"), e.push(" 0% { transform: translateX(0); }"), e.push(" 25% { transform: translateX(5px); }"), e.push(" 50% { transform: translateX(-5px); }"), e.push(" 75% { transform: translateX(2px); }"), e.push(" 100% { transform: translateX(0); }"), e.push(" }"), e.push(""), e.push(" @keyframes radar {"), e.push(" 0% { transform: scale(1); opacity: 0.5; }"), e.push(" 100% { transform: scale(1.5); opacity: 0; }"), e.push(" }"), e.push("}"), n && (e.push(""), e.push("@layer base {"), e.push(" * {"), e.push(" @apply border-border outline-ring/50;"), e.push(" }"), e.push(" body {"), e.push(" @apply bg-background text-foreground;"), e.push(" }"), e.push("}")), e.push(""), e.join(`
152
+ `);
153
+ }
154
+ const w = {
155
+ none: "0px",
156
+ sm: "4px",
157
+ md: "6px",
158
+ lg: "8px",
159
+ xl: "12px",
160
+ full: "9999px"
161
+ };
162
+ export {
163
+ w as borderRadius,
164
+ u as cssVars,
165
+ l as cssVarsFlat,
166
+ m as fontFamily,
167
+ i as fontFamilyValue,
168
+ k as fontSize,
169
+ $ as generateColorSystemCSS,
170
+ j as generateStylesCSS,
171
+ p as quoteFontName,
172
+ S as resolveTheme,
173
+ a as semanticColors,
174
+ h as shadow,
175
+ g as spacing
176
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * PostHog Design System — Shadow Tokens
3
+ */
4
+ export declare const shadow: {
5
+ readonly sm: "0 1px 2px 0 rgba(0, 0, 0, 0.3)";
6
+ readonly md: "0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3)";
7
+ readonly lg: "0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3)";
8
+ };
9
+ export type Shadow = typeof shadow;
10
+ /** Generate Tailwind v4 @theme shadow vars (--shadow-*) */
11
+ export declare function generateShadowCSS(): string;
12
+ //# sourceMappingURL=shadow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shadow.d.ts","sourceRoot":"","sources":["../src/shadow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,MAAM;;;;CAIT,CAAA;AAEV,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAA;AAElC,2DAA2D;AAC3D,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * PostHog Design System — Spacing Tokens
3
+ */
4
+ export declare const spacing: {
5
+ readonly 0: "0px";
6
+ readonly 1: "4px";
7
+ readonly 2: "8px";
8
+ readonly 3: "12px";
9
+ readonly 4: "16px";
10
+ readonly 5: "20px";
11
+ readonly 6: "24px";
12
+ readonly 8: "32px";
13
+ readonly 10: "40px";
14
+ readonly 12: "48px";
15
+ readonly 16: "64px";
16
+ };
17
+ export type Spacing = typeof spacing;
18
+ /** Generate Tailwind v4 @theme spacing vars */
19
+ export declare function generateSpacingCSS(): string;
20
+ //# sourceMappingURL=spacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../src/spacing.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,eAAO,MAAM,OAAO;;;;;;;;;;;;CAYV,CAAA;AAEV,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAA;AAEpC,+CAA+C;AAC/C,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
@@ -0,0 +1,112 @@
1
+ /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
+
3
+ @custom-variant dark (&:is(.dark, .dark *));
4
+
5
+ @theme inline {
6
+ --animate-skeleton: skeleton 2s -1s infinite linear;
7
+ --animate-pulse-glow: pulse-glow 2s -1s infinite linear;
8
+ --animate-horizontal-shake: horizontal-shake 0.3s ease-out;
9
+ --animate-radar: radar 2s ease-out infinite;
10
+
11
+ /* --- Colors --- */
12
+ --color-background: var(--background);
13
+ --color-foreground: var(--foreground);
14
+ --color-card: var(--card);
15
+ --color-card-foreground: var(--card-foreground);
16
+ --color-popover: var(--popover);
17
+ --color-popover-foreground: var(--popover-foreground);
18
+ --color-primary: var(--primary);
19
+ --color-primary-foreground: var(--primary-foreground);
20
+ --color-secondary: var(--secondary);
21
+ --color-secondary-foreground: var(--secondary-foreground);
22
+ --color-muted: var(--muted);
23
+ --color-muted-foreground: var(--muted-foreground);
24
+ --color-accent: var(--accent);
25
+ --color-accent-foreground: var(--accent-foreground);
26
+ --color-destructive: var(--destructive);
27
+ --color-destructive-foreground: var(--destructive-foreground);
28
+ --color-success: var(--success);
29
+ --color-success-foreground: var(--success-foreground);
30
+ --color-warning: var(--warning);
31
+ --color-warning-foreground: var(--warning-foreground);
32
+ --color-info: var(--info);
33
+ --color-info-foreground: var(--info-foreground);
34
+ --color-border: var(--border);
35
+ --color-input: var(--input);
36
+ --color-ring: var(--ring);
37
+ --color-fill-hover: var(--fill-hover);
38
+ --color-fill-active: var(--fill-active);
39
+ --color-fill-expanded: var(--fill-expanded);
40
+ --color-fill-selected: var(--fill-selected);
41
+
42
+ /* --- Spacing --- */
43
+ --spacing-0: 0px;
44
+ --spacing-1: 4px;
45
+ --spacing-2: 8px;
46
+ --spacing-3: 12px;
47
+ --spacing-4: 16px;
48
+ --spacing-5: 20px;
49
+ --spacing-6: 24px;
50
+ --spacing-8: 32px;
51
+ --spacing-10: 40px;
52
+ --spacing-12: 48px;
53
+ --spacing-16: 64px;
54
+
55
+ /* --- Font sizes --- */
56
+ --text-xxs: 0.625rem;
57
+ --text-xxs--line-height: 0.75rem;
58
+ --text-xs: 0.75rem;
59
+ --text-xs--line-height: 1rem;
60
+ --text-sm: 0.875rem;
61
+ --text-sm--line-height: 1.25rem;
62
+ --text-base: 1rem;
63
+ --text-base--line-height: 1.5rem;
64
+ --text-lg: 1.125rem;
65
+ --text-lg--line-height: 1.75rem;
66
+ --text-xl: 1.25rem;
67
+ --text-xl--line-height: 1.75rem;
68
+ --text-2xl: 1.5rem;
69
+ --text-2xl--line-height: 2rem;
70
+
71
+ /* --- Font families --- */
72
+ --font-sans: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
73
+ --font-mono: "JetBrains Mono", "Fira Code", monospace;
74
+
75
+ /* --- Shadows --- */
76
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
77
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
78
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
79
+
80
+ /* --- Radius (derived from --radius base) --- */
81
+ --radius-sm: calc(var(--radius) - 4px);
82
+ --radius-md: calc(var(--radius) - 2px);
83
+ --radius-lg: var(--radius);
84
+ --radius-xl: calc(var(--radius) + 4px);
85
+ --radius-2xl: calc(var(--radius) + 8px);
86
+ --radius-3xl: calc(var(--radius) + 12px);
87
+ --radius-4xl: calc(var(--radius) + 16px);
88
+
89
+ @keyframes skeleton {
90
+ to {
91
+ background-position: -200% 0;
92
+ }
93
+ }
94
+
95
+ @keyframes pulse-glow {
96
+ 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }
97
+ 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }
98
+ }
99
+
100
+ @keyframes horizontal-shake {
101
+ 0% { transform: translateX(0); }
102
+ 25% { transform: translateX(5px); }
103
+ 50% { transform: translateX(-5px); }
104
+ 75% { transform: translateX(2px); }
105
+ 100% { transform: translateX(0); }
106
+ }
107
+
108
+ @keyframes radar {
109
+ 0% { transform: scale(1); opacity: 0.5; }
110
+ 100% { transform: scale(1.5); opacity: 0; }
111
+ }
112
+ }
@@ -0,0 +1,121 @@
1
+ /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
+
3
+ @custom-variant dark (&:is(.dark, .dark *));
4
+
5
+ @theme inline {
6
+ --animate-skeleton: skeleton 2s -1s infinite linear;
7
+ --animate-pulse-glow: pulse-glow 2s -1s infinite linear;
8
+ --animate-horizontal-shake: horizontal-shake 0.3s ease-out;
9
+ --animate-radar: radar 2s ease-out infinite;
10
+
11
+ /* --- Colors --- */
12
+ --color-background: var(--background);
13
+ --color-foreground: var(--foreground);
14
+ --color-card: var(--card);
15
+ --color-card-foreground: var(--card-foreground);
16
+ --color-popover: var(--popover);
17
+ --color-popover-foreground: var(--popover-foreground);
18
+ --color-primary: var(--primary);
19
+ --color-primary-foreground: var(--primary-foreground);
20
+ --color-secondary: var(--secondary);
21
+ --color-secondary-foreground: var(--secondary-foreground);
22
+ --color-muted: var(--muted);
23
+ --color-muted-foreground: var(--muted-foreground);
24
+ --color-accent: var(--accent);
25
+ --color-accent-foreground: var(--accent-foreground);
26
+ --color-destructive: var(--destructive);
27
+ --color-destructive-foreground: var(--destructive-foreground);
28
+ --color-success: var(--success);
29
+ --color-success-foreground: var(--success-foreground);
30
+ --color-warning: var(--warning);
31
+ --color-warning-foreground: var(--warning-foreground);
32
+ --color-info: var(--info);
33
+ --color-info-foreground: var(--info-foreground);
34
+ --color-border: var(--border);
35
+ --color-input: var(--input);
36
+ --color-ring: var(--ring);
37
+ --color-fill-hover: var(--fill-hover);
38
+ --color-fill-active: var(--fill-active);
39
+ --color-fill-expanded: var(--fill-expanded);
40
+ --color-fill-selected: var(--fill-selected);
41
+
42
+ /* --- Spacing --- */
43
+ --spacing-0: 0px;
44
+ --spacing-1: 4px;
45
+ --spacing-2: 8px;
46
+ --spacing-3: 12px;
47
+ --spacing-4: 16px;
48
+ --spacing-5: 20px;
49
+ --spacing-6: 24px;
50
+ --spacing-8: 32px;
51
+ --spacing-10: 40px;
52
+ --spacing-12: 48px;
53
+ --spacing-16: 64px;
54
+
55
+ /* --- Font sizes --- */
56
+ --text-xxs: 0.625rem;
57
+ --text-xxs--line-height: 0.75rem;
58
+ --text-xs: 0.75rem;
59
+ --text-xs--line-height: 1rem;
60
+ --text-sm: 0.875rem;
61
+ --text-sm--line-height: 1.25rem;
62
+ --text-base: 1rem;
63
+ --text-base--line-height: 1.5rem;
64
+ --text-lg: 1.125rem;
65
+ --text-lg--line-height: 1.75rem;
66
+ --text-xl: 1.25rem;
67
+ --text-xl--line-height: 1.75rem;
68
+ --text-2xl: 1.5rem;
69
+ --text-2xl--line-height: 2rem;
70
+
71
+ /* --- Font families --- */
72
+ --font-sans: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
73
+ --font-mono: "JetBrains Mono", "Fira Code", monospace;
74
+
75
+ /* --- Shadows --- */
76
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
77
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
78
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
79
+
80
+ /* --- Radius (derived from --radius base) --- */
81
+ --radius-sm: calc(var(--radius) - 4px);
82
+ --radius-md: calc(var(--radius) - 2px);
83
+ --radius-lg: var(--radius);
84
+ --radius-xl: calc(var(--radius) + 4px);
85
+ --radius-2xl: calc(var(--radius) + 8px);
86
+ --radius-3xl: calc(var(--radius) + 12px);
87
+ --radius-4xl: calc(var(--radius) + 16px);
88
+
89
+ @keyframes skeleton {
90
+ to {
91
+ background-position: -200% 0;
92
+ }
93
+ }
94
+
95
+ @keyframes pulse-glow {
96
+ 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }
97
+ 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }
98
+ }
99
+
100
+ @keyframes horizontal-shake {
101
+ 0% { transform: translateX(0); }
102
+ 25% { transform: translateX(5px); }
103
+ 50% { transform: translateX(-5px); }
104
+ 75% { transform: translateX(2px); }
105
+ 100% { transform: translateX(0); }
106
+ }
107
+
108
+ @keyframes radar {
109
+ 0% { transform: scale(1); opacity: 0.5; }
110
+ 100% { transform: scale(1.5); opacity: 0; }
111
+ }
112
+ }
113
+
114
+ @layer base {
115
+ * {
116
+ @apply border-border outline-ring/50;
117
+ }
118
+ body {
119
+ @apply bg-background text-foreground;
120
+ }
121
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * PostHog Design System — Typography Tokens
3
+ */
4
+ export declare const fontSize: {
5
+ readonly xxs: readonly [string, {
6
+ readonly lineHeight: string;
7
+ }];
8
+ readonly xs: readonly [string, {
9
+ readonly lineHeight: string;
10
+ }];
11
+ readonly sm: readonly [string, {
12
+ readonly lineHeight: string;
13
+ }];
14
+ readonly base: readonly [string, {
15
+ readonly lineHeight: string;
16
+ }];
17
+ readonly lg: readonly [string, {
18
+ readonly lineHeight: string;
19
+ }];
20
+ readonly xl: readonly [string, {
21
+ readonly lineHeight: string;
22
+ }];
23
+ readonly '2xl': readonly [string, {
24
+ readonly lineHeight: string;
25
+ }];
26
+ };
27
+ export declare const fontFamily: {
28
+ readonly sans: readonly ["-apple-system", "BlinkMacSystemFont", "Inter", "Segoe UI", "Roboto", "Helvetica Neue", "sans-serif"];
29
+ readonly mono: readonly ["JetBrains Mono", "Fira Code", "monospace"];
30
+ };
31
+ export type FontSize = typeof fontSize;
32
+ export type FontFamily = typeof fontFamily;
33
+ /** Generate Tailwind v4 @theme font-size vars (--text-* + --text-*--line-height) */
34
+ export declare function generateFontSizeCSS(): string;
35
+ /** Generate Tailwind v4 @theme font-family vars (--font-*) */
36
+ export declare function generateFontFamilyCSS(): string;
37
+ //# sourceMappingURL=typography.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../src/typography.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;CAQX,CAAA;AAEV,eAAO,MAAM,UAAU;;;CAGb,CAAA;AAEV,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAA;AACtC,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAA;AAE1C,oFAAoF;AACpF,wBAAgB,mBAAmB,IAAI,MAAM,CAI5C;AAED,8DAA8D;AAC9D,wBAAgB,qBAAqB,IAAI,MAAM,CAI9C"}
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@posthog/quill-tokens",
3
+ "version": "0.1.0-alpha.0",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/PostHog/posthog.git",
8
+ "directory": "packages/quill/packages/tokens"
9
+ },
10
+ "files": [
11
+ "src",
12
+ "dist"
13
+ ],
14
+ "type": "module",
15
+ "main": "./dist/index.cjs",
16
+ "module": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "require": "./dist/index.cjs",
23
+ "default": "./dist/index.js"
24
+ },
25
+ "./tailwind.css": "./dist/tailwind.css",
26
+ "./tailwind-lib.css": "./dist/tailwind-lib.css",
27
+ "./color-system.css": "./dist/color-system.css"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "devDependencies": {
33
+ "tsx": "^4.19.0",
34
+ "vite": "^6.3.5",
35
+ "vite-plugin-dts": "^4.5.4"
36
+ },
37
+ "scripts": {
38
+ "build": "tsx src/build.ts && vite build",
39
+ "build:watch": "tsx watch src/build.ts"
40
+ }
41
+ }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * PostHog Design System — Border Radius Tokens
3
+ *
4
+ * Note: Tailwind v4 uses --radius as a base value in color-system.css (0.625rem).
5
+ * These are the static design-token values for direct use.
6
+ * The @theme block in styles.css derives --radius-* from the base --radius var.
7
+ */
8
+
9
+ export const borderRadius = {
10
+ none: '0px',
11
+ sm: '4px',
12
+ md: '6px',
13
+ lg: '8px',
14
+ xl: '12px',
15
+ full: '9999px',
16
+ } as const
17
+
18
+ export type BorderRadius = typeof borderRadius
package/src/build.ts ADDED
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Generates CSS files from design tokens.
4
+ *
5
+ * Output:
6
+ * dist/color-system.css — :root + .dark CSS custom properties
7
+ * dist/tailwind.css — @theme + @custom-variant + @layer base (for apps)
8
+ * dist/tailwind-lib.css — @theme + @custom-variant only (for library packages)
9
+ *
10
+ * Note: Neither tailwind.css nor tailwind-lib.css include `@import "tailwindcss"`.
11
+ * The consuming app/package must import tailwindcss itself.
12
+ */
13
+
14
+ import { writeFileSync, mkdirSync } from 'node:fs'
15
+ import { resolve, dirname } from 'node:path'
16
+ import { fileURLToPath } from 'node:url'
17
+
18
+ import { generateColorSystemCSS, generateStylesCSS } from './colors.js'
19
+
20
+ const __dirname = dirname(fileURLToPath(import.meta.url))
21
+ const distDir = resolve(__dirname, '..', 'dist')
22
+
23
+ mkdirSync(distDir, { recursive: true })
24
+
25
+ // 1. Color system (CSS custom properties for light/dark)
26
+ writeFileSync(resolve(distDir, 'color-system.css'), generateColorSystemCSS())
27
+
28
+ // 2. App stylesheet (@theme + base layer, no @import "tailwindcss")
29
+ writeFileSync(resolve(distDir, 'tailwind.css'), generateStylesCSS({ includeBaseLayer: true }))
30
+
31
+ // 3. Library stylesheet (@theme only, no base layer)
32
+ writeFileSync(resolve(distDir, 'tailwind-lib.css'), generateStylesCSS({ includeBaseLayer: false }))
package/src/colors.ts ADDED
@@ -0,0 +1,215 @@
1
+ /**
2
+ * PostHog Design System — Color Tokens (shadcn-aligned)
3
+ *
4
+ * Each value is [light, dark]. Index 0 = light, index 1 = dark.
5
+ */
6
+
7
+ import { cssVarsFlat } from './css'
8
+ import { generateShadowCSS } from './shadow'
9
+ import { generateSpacingCSS } from './spacing'
10
+ import { generateFontSizeCSS, generateFontFamilyCSS } from './typography'
11
+
12
+ export const semanticColors: Record<string, ColorTuple> = {
13
+ background: ['oklch(0.97 0.006 106)', 'hsl(240 8% 8%)', 'bg-background'],
14
+ foreground: ['oklch(0.13 0.028 262)', 'oklch(0.967 0.003 265)', 'text-foreground'],
15
+
16
+ card: ['oklch(1 0 0)', 'hsl(235 8% 15%)', 'bg-card'],
17
+ 'card-foreground': ['oklch(0.13 0.028 262)', 'oklch(0.967 0.003 265)', 'text-card-foreground'],
18
+
19
+ popover: ['oklch(1 0 0)', 'hsl(235 8% 15%)', 'bg-popover'],
20
+ 'popover-foreground': ['oklch(0.13 0.028 262)', 'oklch(0.967 0.003 265)', 'text-popover-foreground'],
21
+
22
+ primary: ['oklch(0.6514 0.2137 37.89)', 'oklch(0.8325 0.1611 84.54)', 'bg-primary'],
23
+ 'primary-foreground': ['oklch(1 0 0)', 'oklch(0.13 0.028 262)', 'text-primary-foreground'],
24
+
25
+ secondary: ['oklch(0.31 0 0)', 'oklch(0.86 0 0)', 'bg-secondary'],
26
+ 'secondary-foreground': ['oklch(1 0 0)', 'oklch(0.13 0.028 262)', 'text-secondary-foreground'],
27
+
28
+ muted: ['oklch(0.97 0.006 106)', 'hsl(240 8% 10%)', 'bg-muted'],
29
+ 'muted-foreground': ['oklch(0.446 0.03 257)', 'oklch(0.709 0 0)', 'text-muted-foreground'],
30
+
31
+ accent: ['oklch(0.923 0.003 49)', 'hsl(230 8% 20%)', 'bg-accent'],
32
+ 'accent-foreground': ['oklch(0.13 0.028 262)', 'oklch(0.967 0.003 265)', 'text-accent-foreground'],
33
+
34
+ destructive: ['oklch(0.92 0.03 32.22)', 'oklch(0.24 0.03 2.79)', 'bg-destructive'],
35
+ 'destructive-foreground': ['oklch(0.59 0.2 23.61)', 'oklch(0.6316 0.1927 24.53)', 'text-destructive-foreground'],
36
+
37
+ success: ['oklch(0.94 0.06 154.03)', 'oklch(0.27 0.04 157.6)', 'bg-success'],
38
+ 'success-foreground': ['oklch(0.448 0.119 151.328)', 'oklch(0.925 0.084 155.995)', 'text-success-foreground'],
39
+
40
+ warning: ['oklch(0.93 0.04 74.41)', 'oklab(0.29 0.03 0.05)', 'bg-warning'],
41
+ 'warning-foreground': ['oklch(0.476 0.114 61.907)', 'oklch(0.77 0.14 99.29)', 'text-warning-foreground'],
42
+
43
+ info: ['oklch(0.882 0.059 254.128)', 'oklch(0.4242 0.1982 265.5 / 40%)', 'bg-info'],
44
+ 'info-foreground': ['oklab(0.49 -0.02 -0.24)', 'oklch(0.882 0.059 254.128)', 'text-info-foreground'],
45
+
46
+ border: ['oklch(0.923 0.003 49)', 'hsl(230 8% 20%)', 'border-border'],
47
+ input: ['oklch(0.81 0 0 / 1)', 'oklch(0.46 0.02 279.18)', 'border-input'],
48
+ ring: ['oklch(0.446 0.03 257)', 'oklch(0.709 0 0)', 'border-ring'],
49
+
50
+ // Hovering default button
51
+ 'fill-hover': [
52
+ 'color-mix(in oklch, var(--accent) 40%, transparent)',
53
+ 'color-mix(in oklch, var(--accent) 40%, transparent)',
54
+ 'bg-fill-hover',
55
+ ],
56
+ // Active default button
57
+ 'fill-active': ['var(--accent)', 'var(--accent)', 'bg-fill-active'],
58
+ // Expanded default button
59
+ 'fill-expanded': ['var(--muted)', 'var(--muted)', 'bg-fill-expanded'],
60
+ // Selected default button (checked or selected)
61
+ 'fill-selected': [
62
+ 'color-mix(in oklch, var(--fill-hover) 50%, transparent)',
63
+ 'color-mix(in oklch, var(--accent) 50%, transparent)',
64
+ 'bg-fill-selected',
65
+ ],
66
+ } as const
67
+
68
+ // ── Types ──────────────────────────────────────────────
69
+
70
+ export type SemanticColorKey = keyof typeof semanticColors
71
+ export type ColorTuple = readonly [light: string, dark: string, tailwindClass: string]
72
+
73
+ // ── Style generation config ────────────────────────────
74
+
75
+ export interface StylesConfig {
76
+ /** Include @layer base reset rules (apps only) */
77
+ includeBaseLayer?: boolean
78
+ }
79
+
80
+ // ── Helpers ────────────────────────────────────────────
81
+
82
+ /** Flat object for one theme */
83
+ export function resolveTheme(mode: 'light' | 'dark'): Record<SemanticColorKey, string> {
84
+ const i = mode === 'light' ? 0 : 1
85
+ return Object.fromEntries(Object.entries(semanticColors).map(([k, v]) => [k, v[i]])) as Record<
86
+ SemanticColorKey,
87
+ string
88
+ >
89
+ }
90
+
91
+ /** Generate color-system.css (:root light + .dark overrides) */
92
+ export function generateColorSystemCSS(): string {
93
+ const varsBlock = (selector: string, i: number): string => {
94
+ const lightDark = Object.fromEntries(Object.entries(semanticColors).map(([k, v]) => [k, v[i]]))
95
+ return `${selector} {\n --radius: 0.625rem;\n${cssVarsFlat(lightDark)}\n}`
96
+ }
97
+
98
+ return `/* Auto-generated by @posthog/quill-tokens — do not edit manually */
99
+
100
+ :root {
101
+ color-scheme: light;
102
+ }
103
+
104
+ .dark {
105
+ color-scheme: dark;
106
+ }
107
+
108
+ ${varsBlock(':root', 0)}
109
+
110
+ ${varsBlock('.dark', 1)}
111
+ `
112
+ }
113
+
114
+ /** Generate Tailwind v4 @theme color mappings (--color-* → var(--*)) */
115
+ function generateColorMappingsCSS(): string {
116
+ return Object.keys(semanticColors)
117
+ .map((k) => ` --color-${k}: var(--${k});`)
118
+ .join('\n')
119
+ }
120
+
121
+ /**
122
+ * Generate Tailwind v4 @theme + @custom-variant + optional @layer base.
123
+ *
124
+ * Does NOT include `@import "tailwindcss"` or `@import "color-system.css"` —
125
+ * those are the consuming app's responsibility (they must resolve from the
126
+ * app's node_modules, not from tokens/dist/).
127
+ *
128
+ * Two modes:
129
+ * - **Library** (includeBaseLayer: false): Just the @theme inline block
130
+ * so Tailwind can generate utility classes. Used by packages.
131
+ *
132
+ * - **App** (includeBaseLayer: true): @theme + base layer resets.
133
+ * Used by apps/web, apps/storybook.
134
+ */
135
+ export function generateStylesCSS(config: StylesConfig = {}): string {
136
+ const { includeBaseLayer = false } = config
137
+
138
+ const lines: string[] = [
139
+ '/* Auto-generated by @posthog/quill-tokens — do not edit manually */',
140
+ '',
141
+ '@custom-variant dark (&:is(.dark, .dark *));',
142
+ ]
143
+ lines.push('')
144
+
145
+ // ── @theme inline ──────────────────────────────────
146
+ lines.push('@theme inline {')
147
+ lines.push(' --animate-skeleton: skeleton 2s -1s infinite linear;')
148
+ lines.push(' --animate-pulse-glow: pulse-glow 2s -1s infinite linear;')
149
+ lines.push(' --animate-horizontal-shake: horizontal-shake 0.3s ease-out;')
150
+ lines.push(' --animate-radar: radar 2s ease-out infinite;')
151
+ lines.push('')
152
+ lines.push(' /* --- Colors --- */')
153
+ lines.push(generateColorMappingsCSS())
154
+ lines.push('')
155
+ lines.push(' /* --- Spacing --- */')
156
+ lines.push(generateSpacingCSS())
157
+ lines.push('')
158
+ lines.push(' /* --- Font sizes --- */')
159
+ lines.push(generateFontSizeCSS())
160
+ lines.push('')
161
+ lines.push(' /* --- Font families --- */')
162
+ lines.push(generateFontFamilyCSS())
163
+ lines.push('')
164
+ lines.push(' /* --- Shadows --- */')
165
+ lines.push(generateShadowCSS())
166
+ lines.push('')
167
+ lines.push(' /* --- Radius (derived from --radius base) --- */')
168
+ lines.push(' --radius-sm: calc(var(--radius) - 4px);')
169
+ lines.push(' --radius-md: calc(var(--radius) - 2px);')
170
+ lines.push(' --radius-lg: var(--radius);')
171
+ lines.push(' --radius-xl: calc(var(--radius) + 4px);')
172
+ lines.push(' --radius-2xl: calc(var(--radius) + 8px);')
173
+ lines.push(' --radius-3xl: calc(var(--radius) + 12px);')
174
+ lines.push(' --radius-4xl: calc(var(--radius) + 16px);')
175
+ lines.push('')
176
+ lines.push(' @keyframes skeleton {')
177
+ lines.push(' to {')
178
+ lines.push(' background-position: -200% 0;')
179
+ lines.push(' }')
180
+ lines.push(' }')
181
+ lines.push('')
182
+ lines.push(' @keyframes pulse-glow {')
183
+ lines.push(' 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }')
184
+ lines.push(' 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }')
185
+ lines.push(' }')
186
+ lines.push('')
187
+ lines.push(' @keyframes horizontal-shake {')
188
+ lines.push(' 0% { transform: translateX(0); }')
189
+ lines.push(' 25% { transform: translateX(5px); }')
190
+ lines.push(' 50% { transform: translateX(-5px); }')
191
+ lines.push(' 75% { transform: translateX(2px); }')
192
+ lines.push(' 100% { transform: translateX(0); }')
193
+ lines.push(' }')
194
+ lines.push('')
195
+ lines.push(' @keyframes radar {')
196
+ lines.push(' 0% { transform: scale(1); opacity: 0.5; }')
197
+ lines.push(' 100% { transform: scale(1.5); opacity: 0; }')
198
+ lines.push(' }')
199
+ lines.push('}')
200
+
201
+ if (includeBaseLayer) {
202
+ lines.push('')
203
+ lines.push('@layer base {')
204
+ lines.push(' * {')
205
+ lines.push(' @apply border-border outline-ring/50;')
206
+ lines.push(' }')
207
+ lines.push(' body {')
208
+ lines.push(' @apply bg-background text-foreground;')
209
+ lines.push(' }')
210
+ lines.push('}')
211
+ }
212
+
213
+ lines.push('')
214
+ return lines.join('\n')
215
+ }
package/src/css.ts ADDED
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Shared CSS generation helpers for token files.
3
+ */
4
+
5
+ /** Generate CSS custom property lines from a flat key-value map */
6
+ export function cssVars(tokens: Record<string, string>, prefix: string, indent = ' '): string {
7
+ return Object.entries(tokens)
8
+ .map(([k, v]) => `${indent}--${prefix}-${k}: ${v};`)
9
+ .join('\n')
10
+ }
11
+
12
+ /** Generate CSS custom property lines without a prefix */
13
+ export function cssVarsFlat(tokens: Record<string, string>, indent = ' '): string {
14
+ return Object.entries(tokens)
15
+ .map(([k, v]) => `${indent}--${k}: ${v};`)
16
+ .join('\n')
17
+ }
18
+
19
+ /** Quote a font name if it contains spaces, otherwise return as-is */
20
+ export function quoteFontName(name: string): string {
21
+ return /\s/.test(name) ? `"${name}"` : name
22
+ }
23
+
24
+ /** Format a font family array as a CSS value */
25
+ export function fontFamilyValue(fonts: readonly string[]): string {
26
+ return fonts.map(quoteFontName).join(', ')
27
+ }
package/src/index.ts ADDED
@@ -0,0 +1,22 @@
1
+ // Colors
2
+ export { semanticColors, resolveTheme, generateColorSystemCSS, generateStylesCSS } from './colors'
3
+ export type { SemanticColorKey, ColorTuple, StylesConfig } from './colors'
4
+
5
+ // Spacing
6
+ export { spacing } from './spacing'
7
+ export type { Spacing } from './spacing'
8
+
9
+ // Typography
10
+ export { fontSize, fontFamily } from './typography'
11
+ export type { FontSize, FontFamily } from './typography'
12
+
13
+ // Border Radius
14
+ export { borderRadius } from './border-radius'
15
+ export type { BorderRadius } from './border-radius'
16
+
17
+ // Shadows
18
+ export { shadow } from './shadow'
19
+ export type { Shadow } from './shadow'
20
+
21
+ // CSS utilities
22
+ export { cssVars, cssVarsFlat, quoteFontName, fontFamilyValue } from './css'
package/src/shadow.ts ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * PostHog Design System — Shadow Tokens
3
+ */
4
+
5
+ import { cssVars } from './css'
6
+
7
+ export const shadow = {
8
+ sm: '0 1px 2px 0 rgba(0, 0, 0, 0.3)',
9
+ md: '0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3)',
10
+ lg: '0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3)',
11
+ } as const
12
+
13
+ export type Shadow = typeof shadow
14
+
15
+ /** Generate Tailwind v4 @theme shadow vars (--shadow-*) */
16
+ export function generateShadowCSS(): string {
17
+ return cssVars(shadow as unknown as Record<string, string>, 'shadow')
18
+ }
package/src/spacing.ts ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * PostHog Design System — Spacing Tokens
3
+ */
4
+
5
+ import { cssVars } from './css'
6
+
7
+ export const spacing = {
8
+ 0: '0px',
9
+ 1: '4px',
10
+ 2: '8px',
11
+ 3: '12px',
12
+ 4: '16px',
13
+ 5: '20px',
14
+ 6: '24px',
15
+ 8: '32px',
16
+ 10: '40px',
17
+ 12: '48px',
18
+ 16: '64px',
19
+ } as const
20
+
21
+ export type Spacing = typeof spacing
22
+
23
+ /** Generate Tailwind v4 @theme spacing vars */
24
+ export function generateSpacingCSS(): string {
25
+ return cssVars(spacing as unknown as Record<string, string>, 'spacing')
26
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * PostHog Design System — Typography Tokens
3
+ */
4
+
5
+ import { fontFamilyValue } from './css'
6
+
7
+ const ROOT_FONT_SIZE = 16
8
+
9
+ function rem(px: number): string {
10
+ return `${px / ROOT_FONT_SIZE}rem`
11
+ }
12
+
13
+ export const fontSize = {
14
+ xxs: [rem(10), { lineHeight: rem(12) }], // 0.625rem (10px), 0.75rem (12px)
15
+ xs: [rem(12), { lineHeight: rem(16) }], // 0.75rem (12px), 1rem (16px)
16
+ sm: [rem(14), { lineHeight: rem(20) }], // 0.875rem (14px), 1.25rem (20px)
17
+ base: [rem(16), { lineHeight: rem(24) }], // 1rem (16px), 1.5rem (24px)
18
+ lg: [rem(18), { lineHeight: rem(28) }], // 1.125rem (18px), 1.75rem (28px)
19
+ xl: [rem(20), { lineHeight: rem(28) }], // 1.25rem (20px), 1.75rem (28px)
20
+ '2xl': [rem(24), { lineHeight: rem(32) }], // 1.5rem (24px), 2rem (32px)
21
+ } as const
22
+
23
+ export const fontFamily = {
24
+ sans: ['-apple-system', 'BlinkMacSystemFont', 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', 'sans-serif'],
25
+ mono: ['JetBrains Mono', 'Fira Code', 'monospace'],
26
+ } as const
27
+
28
+ export type FontSize = typeof fontSize
29
+ export type FontFamily = typeof fontFamily
30
+
31
+ /** Generate Tailwind v4 @theme font-size vars (--text-* + --text-*--line-height) */
32
+ export function generateFontSizeCSS(): string {
33
+ return Object.entries(fontSize)
34
+ .map(([k, [size, { lineHeight }]]) => ` --text-${k}: ${size};\n --text-${k}--line-height: ${lineHeight};`)
35
+ .join('\n')
36
+ }
37
+
38
+ /** Generate Tailwind v4 @theme font-family vars (--font-*) */
39
+ export function generateFontFamilyCSS(): string {
40
+ return Object.entries(fontFamily)
41
+ .map(([k, fonts]) => ` --font-${k}: ${fontFamilyValue(fonts)};`)
42
+ .join('\n')
43
+ }