@posthog/quill-tokens 0.1.0-alpha.7 → 0.1.2-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.
@@ -4,7 +4,7 @@
4
4
  color-scheme: light;
5
5
  }
6
6
 
7
- .dark {
7
+ :is(.dark, [theme="dark"]) {
8
8
  color-scheme: dark;
9
9
  }
10
10
 
@@ -39,7 +39,7 @@
39
39
  --ring: oklch(0.446 0.03 257);
40
40
  }
41
41
 
42
- .dark {
42
+ :is(.dark, [theme="dark"]) {
43
43
  --foreground: oklch(0.967 0.003 265);
44
44
  --card-foreground: oklch(0.967 0.003 265);
45
45
  --popover-foreground: oklch(0.967 0.003 265);
@@ -78,7 +78,7 @@
78
78
  --fill-hover: oklch(0.87 0 0 / 20%);
79
79
  }
80
80
 
81
- :is(.dark, .dark *) {
81
+ :is(:is(.dark, [theme="dark"]), :is(.dark, [theme="dark"]) *) {
82
82
  --background: oklch(0.145 calc(var(--theme-tint) * 1.5) var(--theme-dark-hue));
83
83
  --card: oklch(0.2 calc(var(--theme-tint) * 1.2) var(--theme-dark-hue));
84
84
  --popover: oklch(0.21 calc(var(--theme-tint) * 1.2) var(--theme-dark-hue));
@@ -0,0 +1,119 @@
1
+ /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
+
3
+ /*
4
+ * Scoped output — all token vars are gated behind `[data-quill]` so they
5
+ * do not clash with the consumer's existing CSS custom properties.
6
+ * Add the `data-quill` attribute to wrapper elements
7
+ * where quill components are rendered.
8
+ *
9
+ * Dark mode: works when the dark selector is on an ancestor of the scope
10
+ * element (.dark > [data-quill]) OR on the scope element itself
11
+ * ([data-quill].dark).
12
+ */
13
+ [data-quill] {
14
+ color-scheme: light;
15
+ }
16
+
17
+ :is(:is(.dark, [theme="dark"]) [data-quill], [data-quill]:is(.dark, [theme="dark"])) {
18
+ color-scheme: dark;
19
+ }
20
+
21
+ :is([data-quill], [data-quill] *) {
22
+ --radius: 0.625rem;
23
+ --theme-hue: 90;
24
+ --theme-dark-hue: 264;
25
+ --theme-tint: 0.006;
26
+ --primary-light: oklch(0.65 0.21 37.41);
27
+ --primary-dark: oklch(0.83 0.16 84.71);
28
+ --foreground: oklch(0.13 0.028 262);
29
+ --card-foreground: oklch(0.13 0.028 262);
30
+ --popover-foreground: oklch(0.13 0.028 262);
31
+ --muted-foreground: oklch(0.446 0.03 257);
32
+ --accent-foreground: oklch(0.13 0.028 262);
33
+ --primary-foreground: oklch(1 0 0);
34
+ --secondary: oklch(0.31 0 0);
35
+ --secondary-foreground: oklch(1 0 0);
36
+ --destructive: oklch(0.92 0.03 32.22);
37
+ --destructive-foreground: oklch(0.59 0.2 23.61);
38
+ --success: oklch(0.94 0.06 154.03);
39
+ --success-foreground: oklch(0.448 0.119 151.328);
40
+ --warning: oklch(0.93 0.04 74.41);
41
+ --warning-foreground: oklch(0.476 0.114 61.907);
42
+ --info: oklch(0.882 0.059 254.128);
43
+ --info-foreground: oklch(0.49 0.02 254);
44
+ --ring: oklch(0.446 0.03 257);
45
+ --background: oklch(0.97 var(--theme-tint) var(--theme-hue));
46
+ --card: oklch(0.995 calc(var(--theme-tint) * 0.3) var(--theme-hue));
47
+ --popover: oklch(0.995 calc(var(--theme-tint) * 0.3) var(--theme-hue));
48
+ --muted: oklch(0.94 calc(var(--theme-tint) * 1.5) var(--theme-hue));
49
+ --accent: oklch(0.87 calc(var(--theme-tint) * 0.8) var(--theme-hue));
50
+ --primary: var(--primary-light);
51
+ --border: oklch(0.9 calc(var(--theme-tint) * 0.8) var(--theme-hue));
52
+ --input: oklch(0.81 calc(var(--theme-tint) * 0.5) var(--theme-hue));
53
+ --fill-expanded: oklch(0.87 0 0 / 60%);
54
+ --fill-selected: oklch(0.87 0 0 / 40%);
55
+ --fill-hover: oklch(0.87 0 0 / 20%);
56
+
57
+ /* Override Tailwind --color-* theme tokens within scope so utilities
58
+ * like bg-accent, text-foreground, border-border resolve to quill's
59
+ * values instead of the consumer's global theme. */
60
+ --color-background: var(--background);
61
+ --color-foreground: var(--foreground);
62
+ --color-card: var(--card);
63
+ --color-card-foreground: var(--card-foreground);
64
+ --color-popover: var(--popover);
65
+ --color-popover-foreground: var(--popover-foreground);
66
+ --color-muted: var(--muted);
67
+ --color-muted-foreground: var(--muted-foreground);
68
+ --color-accent: var(--accent);
69
+ --color-accent-foreground: var(--accent-foreground);
70
+ --color-primary: var(--primary);
71
+ --color-primary-foreground: var(--primary-foreground);
72
+ --color-secondary: var(--secondary);
73
+ --color-secondary-foreground: var(--secondary-foreground);
74
+ --color-destructive: var(--destructive);
75
+ --color-destructive-foreground: var(--destructive-foreground);
76
+ --color-success: var(--success);
77
+ --color-success-foreground: var(--success-foreground);
78
+ --color-warning: var(--warning);
79
+ --color-warning-foreground: var(--warning-foreground);
80
+ --color-info: var(--info);
81
+ --color-info-foreground: var(--info-foreground);
82
+ --color-border: var(--border);
83
+ --color-input: var(--input);
84
+ --color-ring: var(--ring);
85
+ --color-fill-expanded: var(--fill-expanded);
86
+ --color-fill-selected: var(--fill-selected);
87
+ --color-fill-hover: var(--fill-hover);
88
+ }
89
+
90
+ :is(:is(.dark, [theme="dark"]) [data-quill], [data-quill]:is(.dark, [theme="dark"]), :is(.dark, [theme="dark"]) [data-quill] *, [data-quill]:is(.dark, [theme="dark"]) *) {
91
+ --foreground: oklch(0.967 0.003 265);
92
+ --card-foreground: oklch(0.967 0.003 265);
93
+ --popover-foreground: oklch(0.967 0.003 265);
94
+ --muted-foreground: oklch(0.709 0 0);
95
+ --accent-foreground: oklch(0.967 0.003 265);
96
+ --primary-foreground: oklch(0.13 0.028 262);
97
+ --secondary: oklch(0.86 0 0);
98
+ --secondary-foreground: oklch(0.13 0.028 262);
99
+ --destructive: oklch(0.24 0.03 2.79);
100
+ --destructive-foreground: oklch(0.6316 0.1927 24.53);
101
+ --success: oklch(0.27 0.04 157.6);
102
+ --success-foreground: oklch(0.925 0.084 155.995);
103
+ --warning: oklch(0.29 0.03 75);
104
+ --warning-foreground: oklch(0.77 0.14 99.29);
105
+ --info: oklch(0.4242 0.1982 265.5 / 40%);
106
+ --info-foreground: oklch(0.882 0.059 254.128);
107
+ --ring: oklch(0.709 0 0);
108
+ --background: oklch(0.145 calc(var(--theme-tint) * 1.5) var(--theme-dark-hue));
109
+ --card: oklch(0.2 calc(var(--theme-tint) * 1.2) var(--theme-dark-hue));
110
+ --popover: oklch(0.21 calc(var(--theme-tint) * 1.2) var(--theme-dark-hue));
111
+ --muted: oklch(0.27 calc(var(--theme-tint) * 1.5) var(--theme-dark-hue));
112
+ --accent: oklch(0.35 calc(var(--theme-tint) * 1.2) var(--theme-dark-hue));
113
+ --primary: var(--primary-dark);
114
+ --border: oklch(0.27 calc(var(--theme-tint) * 1.2) var(--theme-dark-hue));
115
+ --input: oklch(0.3 calc(var(--theme-tint) * 1.5) var(--theme-dark-hue));
116
+ --fill-expanded: oklch(0.55 0 0 / 35%);
117
+ --fill-selected: oklch(0.55 0 0 / 25%);
118
+ --fill-hover: oklch(0.55 0 0 / 15%);
119
+ }
package/dist/colors.d.ts CHANGED
@@ -42,11 +42,31 @@ export declare const semanticColors: Record<string, ColorTuple>;
42
42
  export interface StylesConfig {
43
43
  /** Include @layer base reset rules (apps only) */
44
44
  includeBaseLayer?: boolean;
45
+ /**
46
+ * CSS selector to scope all token CSS vars to. When set, vars are only
47
+ * defined inside elements matching this selector, preventing clashes
48
+ * with the consumer's existing CSS custom properties.
49
+ *
50
+ * Example: `'[data-quill]'` — consumer adds `data-quill` to wrapper
51
+ * elements. During migration the attribute moves up the DOM tree;
52
+ * when it reaches `<html>` the scope is effectively global and can
53
+ * be removed.
54
+ */
55
+ scope?: string;
56
+ /**
57
+ * CSS selector(s) for dark mode. Accepts a single selector or an
58
+ * array — when multiple are given they are combined with `:is()`
59
+ * so any of them activates dark mode.
60
+ *
61
+ * Default: `['.dark', '[theme="dark"]']` (both `.dark` class and
62
+ * `theme="dark"` attribute work out of the box).
63
+ */
64
+ darkSelector?: string | string[];
45
65
  }
46
66
  /** Flat object for one theme */
47
67
  export declare function resolveTheme(mode: 'light' | 'dark'): Record<string, string>;
48
68
  /** Generate color-system.css (:root light + .dark overrides) */
49
- export declare function generateColorSystemCSS(theme?: ThemeConfig): string;
69
+ export declare function generateColorSystemCSS(theme?: ThemeConfig, opts?: Pick<StylesConfig, 'scope' | 'darkSelector'>): string;
50
70
  /**
51
71
  * Generate Tailwind v4 @theme + @custom-variant + optional @layer base.
52
72
  *
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,MAAM,WAAW,WAAW;IACxB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAA;IACX,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAA;CACtB;AAED,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,WAM3B,CAAA;AAID,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACrC,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAA;AA8BtF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAuEhE;AAED,eAAO,MAAM,cAAc,4BAAwB,CAAA;AAInD,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,MAAM,EAAE,MAAM,CAAC,CAG3E;AA6DD,gEAAgE;AAChE,wBAAgB,sBAAsB,CAAC,KAAK,GAAE,WAA2B,GAAG,MAAM,CAiEjF;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,YAAiB,GAAG,MAAM,CAgFnE"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../src/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,MAAM,WAAW,WAAW;IACxB,sDAAsD;IACtD,GAAG,EAAE,MAAM,CAAA;IACX,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAA;IACZ;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAA;IACpB,0DAA0D;IAC1D,WAAW,EAAE,MAAM,CAAA;CACtB;AAED,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,WAM3B,CAAA;AAID,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAA;AACrC,MAAM,MAAM,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,CAAC,CAAA;AA8BtF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAuEhE;AAED,eAAO,MAAM,cAAc,4BAAwB,CAAA;AAInD,MAAM,WAAW,YAAY;IACzB,kDAAkD;IAClD,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;;;;;;;;OASG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CACnC;AAID,gCAAgC;AAChC,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAG3E;AAmED,gEAAgE;AAChE,wBAAgB,sBAAsB,CAClC,KAAK,GAAE,WAA2B,EAClC,IAAI,GAAE,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,cAAc,CAAM,GACxD,MAAM,CAqHR;AASD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,GAAE,YAAiB,GAAG,MAAM,CAwFnE"}
package/dist/index.cjs CHANGED
@@ -1,32 +1,66 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function m(r,o,e=" "){return Object.entries(r).map(([s,u])=>`${e}--${o}-${s}: ${u};`).join(`
2
- `)}function c(r,o=" "){return Object.entries(r).map(([e,s])=>`${o}--${e}: ${s};`).join(`
3
- `)}function x(r){return/\s/.test(r)?`"${r}"`:r}function k(r){return r.map(x).join(", ")}const b={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 C(){return m(b,"shadow")}const h=.25,y=`${h}rem`,w=16;function F(r){return`${h*r}rem`}function _(r){return h*r*w}function V(){return` --spacing: ${y};`}const j=16;function n(r){return`${r/j}rem`}const v={xxs:[n(10),{lineHeight:n(12)}],xs:[n(12),{lineHeight:n(16)}],sm:[n(14),{lineHeight:n(20)}],base:[n(16),{lineHeight:n(24)}],lg:[n(18),{lineHeight:n(28)}],xl:[n(20),{lineHeight:n(28)}],"2xl":[n(24),{lineHeight:n(32)}]},S={sans:["-apple-system","BlinkMacSystemFont","Inter","Segoe UI","Roboto","Helvetica Neue","sans-serif"],mono:["JetBrains Mono","Fira Code","monospace"]};function O(){return Object.entries(v).map(([r,[o,{lineHeight:e}]])=>` --text-${r}: ${o};
4
- --text-${r}--line-height: ${e};`).join(`
5
- `)}function A(){return Object.entries(S).map(([r,o])=>` --font-${r}: ${k(o)};`).join(`
6
- `)}const $={hue:90,darkHue:264,tint:.006,primaryLight:"oklch(0.65 0.21 37.41)",primaryDark:"oklch(0.83 0.16 84.71)"};function a(r,o,e,s){const u=e==="light"?"var(--theme-hue)":"var(--theme-dark-hue)",i=o===1?"var(--theme-tint)":o===0?"0":`calc(var(--theme-tint) * ${o})`;return`oklch(${r} ${i} ${u})`}function t(r,o,e,s){return s!==void 0?`oklch(${r} ${o} ${e} / ${s*100}%)`:`oklch(${r} ${o} ${e})`}function E(){return{background:[a(.97,1,"light"),a(.145,1.5,"dark"),"bg-background"],foreground:[t(.13,.028,262),t(.967,.003,265),"text-foreground"],card:[a(.995,.3,"light"),a(.2,1.2,"dark"),"bg-card"],"card-foreground":[t(.13,.028,262),t(.967,.003,265),"text-card-foreground"],popover:[a(.995,.3,"light"),a(.21,1.2,"dark"),"bg-popover"],"popover-foreground":[t(.13,.028,262),t(.967,.003,265),"text-popover-foreground"],muted:[a(.94,1.5,"light"),a(.27,1.5,"dark"),"bg-muted"],"muted-foreground":[t(.446,.03,257),t(.709,0,0),"text-muted-foreground"],accent:[a(.87,.8,"light"),a(.35,1.2,"dark"),"bg-accent"],"accent-foreground":[t(.13,.028,262),t(.967,.003,265),"text-accent-foreground"],primary:["var(--primary-light)","var(--primary-dark)","bg-primary"],"primary-foreground":[t(1,0,0),t(.13,.028,262),"text-primary-foreground"],secondary:[t(.31,0,0),t(.86,0,0),"bg-secondary"],"secondary-foreground":[t(1,0,0),t(.13,.028,262),"text-secondary-foreground"],destructive:[t(.92,.03,32.22),t(.24,.03,2.79),"bg-destructive"],"destructive-foreground":[t(.59,.2,23.61),t(.6316,.1927,24.53),"text-destructive-foreground"],success:[t(.94,.06,154.03),t(.27,.04,157.6),"bg-success"],"success-foreground":[t(.448,.119,151.328),t(.925,.084,155.995),"text-success-foreground"],warning:[t(.93,.04,74.41),t(.29,.03,75),"bg-warning"],"warning-foreground":[t(.476,.114,61.907),t(.77,.14,99.29),"text-warning-foreground"],info:[t(.882,.059,254.128),t(.4242,.1982,265.5,.4),"bg-info"],"info-foreground":[t(.49,.02,254),t(.882,.059,254.128),"text-info-foreground"],border:[a(.9,.8,"light"),a(.27,1.2,"dark"),"border-border"],input:[a(.81,.5,"light"),a(.3,1.5,"dark"),"border-input"],ring:[t(.446,.03,257),t(.709,0,0),"border-ring"],"fill-expanded":["oklch(0.87 0 0 / 60%)","oklch(0.55 0 0 / 35%)","bg-fill-expanded"],"fill-selected":["oklch(0.87 0 0 / 40%)","oklch(0.55 0 0 / 25%)","bg-fill-selected"],"fill-hover":["oklch(0.87 0 0 / 20%)","oklch(0.55 0 0 / 15%)","bg-fill-hover"]}}const p=E();function H(r){const o=r==="light"?0:1;return Object.fromEntries(Object.entries(p).map(([e,s])=>[e,s[o]]))}const T=new Set(["background","card","popover","muted","accent","primary","border","input","fill-hover","fill-active","fill-expanded","fill-selected"]);function R(r){const o=["var(--theme-hue)","var(--theme-dark-hue)","var(--theme-tint)","var(--primary-light)","var(--primary-dark)"];for(const[e,[s,u]]of Object.entries(r))if(o.some(l=>s.includes(l)||u.includes(l))&&!T.has(e))throw new Error(`[@posthog/quill-tokens] Token "${e}" references a theme variable but is missing from THEME_DERIVED_TOKENS. Add it to the set in colors.ts or local [--theme-hue:X] overrides will silently fail for this token.`)}R(p);function D(r=$){const o=(i=" ")=>[`${i}--theme-hue: ${r.hue};`,`${i}--theme-dark-hue: ${r.darkHue};`,`${i}--theme-tint: ${r.tint};`,`${i}--primary-light: ${r.primaryLight};`,`${i}--primary-dark: ${r.primaryDark};`].join(`
7
- `),e=i=>{const l={},g={};for(const[d,f]of Object.entries(p))T.has(d)?g[d]=f[i]:l[d]=f[i];return{staticVars:l,dynamicVars:g}},s=e(0),u=e(1);return`/* Auto-generated by @posthog/quill-tokens — do not edit manually */
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function b(r,n,t=" "){return Object.entries(r).map(([s,l])=>`${t}--${n}-${s}: ${l};`).join(`
2
+ `)}function c(r,n=" "){return Object.entries(r).map(([t,s])=>`${n}--${t}: ${s};`).join(`
3
+ `)}function x(r){return/\s/.test(r)?`"${r}"`:r}function y(r){return r.map(x).join(", ")}const S={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 _(){return b(S,"shadow")}const m=.25,v=`${m}rem`,j=16;function A(r){return`${m*r}rem`}function H(r){return m*r*j}function D(){return` --spacing: ${v};`}const R=16;function a(r){return`${r/R}rem`}const E={xxs:[a(10),{lineHeight:a(12)}],xs:[a(12),{lineHeight:a(16)}],sm:[a(14),{lineHeight:a(20)}],base:[a(16),{lineHeight:a(24)}],lg:[a(18),{lineHeight:a(28)}],xl:[a(20),{lineHeight:a(28)}],"2xl":[a(24),{lineHeight:a(32)}]},T={sans:["-apple-system","BlinkMacSystemFont","Inter","Segoe UI","Roboto","Helvetica Neue","sans-serif"],mono:["JetBrains Mono","Fira Code","monospace"]};function I(){return Object.entries(E).map(([r,[n,{lineHeight:t}]])=>` --text-${r}: ${n};
4
+ --text-${r}--line-height: ${t};`).join(`
5
+ `)}function M(){return Object.entries(T).map(([r,n])=>` --font-${r}: ${y(n)};`).join(`
6
+ `)}const w={hue:90,darkHue:264,tint:.006,primaryLight:"oklch(0.65 0.21 37.41)",primaryDark:"oklch(0.83 0.16 84.71)"};function i(r,n,t,s){const l=t==="light"?"var(--theme-hue)":"var(--theme-dark-hue)",e=n===1?"var(--theme-tint)":n===0?"0":`calc(var(--theme-tint) * ${n})`;return`oklch(${r} ${e} ${l})`}function o(r,n,t,s){return s!==void 0?`oklch(${r} ${n} ${t} / ${s*100}%)`:`oklch(${r} ${n} ${t})`}function C(){return{background:[i(.97,1,"light"),i(.145,1.5,"dark"),"bg-background"],foreground:[o(.13,.028,262),o(.967,.003,265),"text-foreground"],card:[i(.995,.3,"light"),i(.2,1.2,"dark"),"bg-card"],"card-foreground":[o(.13,.028,262),o(.967,.003,265),"text-card-foreground"],popover:[i(.995,.3,"light"),i(.21,1.2,"dark"),"bg-popover"],"popover-foreground":[o(.13,.028,262),o(.967,.003,265),"text-popover-foreground"],muted:[i(.94,1.5,"light"),i(.27,1.5,"dark"),"bg-muted"],"muted-foreground":[o(.446,.03,257),o(.709,0,0),"text-muted-foreground"],accent:[i(.87,.8,"light"),i(.35,1.2,"dark"),"bg-accent"],"accent-foreground":[o(.13,.028,262),o(.967,.003,265),"text-accent-foreground"],primary:["var(--primary-light)","var(--primary-dark)","bg-primary"],"primary-foreground":[o(1,0,0),o(.13,.028,262),"text-primary-foreground"],secondary:[o(.31,0,0),o(.86,0,0),"bg-secondary"],"secondary-foreground":[o(1,0,0),o(.13,.028,262),"text-secondary-foreground"],destructive:[o(.92,.03,32.22),o(.24,.03,2.79),"bg-destructive"],"destructive-foreground":[o(.59,.2,23.61),o(.6316,.1927,24.53),"text-destructive-foreground"],success:[o(.94,.06,154.03),o(.27,.04,157.6),"bg-success"],"success-foreground":[o(.448,.119,151.328),o(.925,.084,155.995),"text-success-foreground"],warning:[o(.93,.04,74.41),o(.29,.03,75),"bg-warning"],"warning-foreground":[o(.476,.114,61.907),o(.77,.14,99.29),"text-warning-foreground"],info:[o(.882,.059,254.128),o(.4242,.1982,265.5,.4),"bg-info"],"info-foreground":[o(.49,.02,254),o(.882,.059,254.128),"text-info-foreground"],border:[i(.9,.8,"light"),i(.27,1.2,"dark"),"border-border"],input:[i(.81,.5,"light"),i(.3,1.5,"dark"),"border-input"],ring:[o(.446,.03,257),o(.709,0,0),"border-ring"],"fill-expanded":["oklch(0.87 0 0 / 60%)","oklch(0.55 0 0 / 35%)","bg-fill-expanded"],"fill-selected":["oklch(0.87 0 0 / 40%)","oklch(0.55 0 0 / 25%)","bg-fill-selected"],"fill-hover":["oklch(0.87 0 0 / 20%)","oklch(0.55 0 0 / 15%)","bg-fill-hover"]}}const p=C();function N(r){const n=r==="light"?0:1;return Object.fromEntries(Object.entries(p).map(([t,s])=>[t,s[n]]))}const V=new Set(["background","card","popover","muted","accent","primary","border","input","fill-hover","fill-expanded","fill-selected"]);function q(r){const n=["var(--theme-hue)","var(--theme-dark-hue)","var(--theme-tint)","var(--primary-light)","var(--primary-dark)"];for(const[t,[s,l]]of Object.entries(r))if(n.some(h=>s.includes(h)||l.includes(h))&&!V.has(t))throw new Error(`[@posthog/quill-tokens] Token "${t}" references a theme variable but is missing from THEME_DERIVED_TOKENS. Add it to the set in colors.ts or local [--theme-hue:X] overrides will silently fail for this token.`)}q(p);function F(r){const t=r===void 0?[".dark",'[theme="dark"]']:typeof r=="string"?[r]:r;return t.length===1?t[0]:`:is(${t.join(", ")})`}function B(r=w,n={}){const{scope:t}=n,s=F(n.darkSelector),l=(u=" ")=>[`${u}--radius: 0.625rem;`,`${u}--theme-hue: ${r.hue};`,`${u}--theme-dark-hue: ${r.darkHue};`,`${u}--theme-tint: ${r.tint};`,`${u}--primary-light: ${r.primaryLight};`,`${u}--primary-dark: ${r.primaryDark};`].join(`
7
+ `),e=u=>{const g={},$={};for(const[f,k]of Object.entries(p))V.has(f)?$[f]=k[u]:g[f]=k[u];return{staticVars:g,dynamicVars:$}},h=e(0),d=e(1);if(t){const u=`:is(${t}, ${t} *)`,g=`:is(${s} ${t}, ${t}${s}, ${s} ${t} *, ${t}${s} *)`;return`/* Auto-generated by @posthog/quill-tokens — do not edit manually */
8
+
9
+ /*
10
+ * Scoped output — all token vars are gated behind \`${t}\` so they
11
+ * do not clash with the consumer's existing CSS custom properties.
12
+ * Add the \`${t.replace(/[[\]]/g,"")}\` attribute to wrapper elements
13
+ * where quill components are rendered.
14
+ *
15
+ * Dark mode: works when the dark selector is on an ancestor of the scope
16
+ * element (.dark > [data-quill]) OR on the scope element itself
17
+ * ([data-quill].dark).
18
+ */
19
+ ${t} {
20
+ color-scheme: light;
21
+ }
22
+
23
+ :is(${s} ${t}, ${t}${s}) {
24
+ color-scheme: dark;
25
+ }
26
+
27
+ ${u} {
28
+ ${l()}
29
+ ${c(h.staticVars)}
30
+ ${c(h.dynamicVars)}
31
+
32
+ /* Override Tailwind --color-* theme tokens within scope so utilities
33
+ * like bg-accent, text-foreground, border-border resolve to quill's
34
+ * values instead of the consumer's global theme. */
35
+ ${O()}
36
+ }
37
+
38
+ ${g} {
39
+ ${c(d.staticVars)}
40
+ ${c(d.dynamicVars)}
41
+ }
42
+ `}return`/* Auto-generated by @posthog/quill-tokens — do not edit manually */
8
43
 
9
44
  :root {
10
45
  color-scheme: light;
11
46
  }
12
47
 
13
- .dark {
48
+ ${s} {
14
49
  color-scheme: dark;
15
50
  }
16
51
 
17
52
  /* Theme knobs — override these to shift the palette */
18
53
  :root {
19
- --radius: 0.625rem;
20
- ${o()}
54
+ ${l()}
21
55
  }
22
56
 
23
57
  /* Static colors (no theme-var references, safe on :root) */
24
58
  :root {
25
- ${c(s.staticVars)}
59
+ ${c(h.staticVars)}
26
60
  }
27
61
 
28
- .dark {
29
- ${c(u.staticVars)}
62
+ ${s} {
63
+ ${c(d.staticVars)}
30
64
  }
31
65
 
32
66
  /*
@@ -35,12 +69,12 @@ ${c(u.staticVars)}
35
69
  * This enables local overrides like [--theme-hue:200] on a container.
36
70
  */
37
71
  * {
38
- ${c(s.dynamicVars)}
72
+ ${c(h.dynamicVars)}
39
73
  }
40
74
 
41
- :is(.dark, .dark *) {
42
- ${c(u.dynamicVars)}
75
+ :is(${s}, ${s} *) {
76
+ ${c(d.dynamicVars)}
43
77
  }
44
- `}function I(){return Object.keys(p).map(r=>` --color-${r}: var(--${r});`).join(`
45
- `)}function M(r={}){const{includeBaseLayer:o=!1}=r,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(I()),e.push(""),e.push(" /* --- Spacing --- */"),e.push(V()),e.push(""),e.push(" /* --- Font sizes --- */"),e.push(O()),e.push(""),e.push(" /* --- Font families --- */"),e.push(A()),e.push(""),e.push(" /* --- Shadows --- */"),e.push(C()),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("}"),o&&(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(`
46
- `)}const N={none:"0px",sm:"4px",md:"6px",lg:"8px",xl:"12px",full:"9999px"};exports.DEFAULT_THEME=$;exports.SPACING_BASE=y;exports.SPACING_BASE_REM=h;exports.borderRadius=N;exports.buildSemanticColors=E;exports.cssVars=m;exports.cssVarsFlat=c;exports.fontFamily=S;exports.fontFamilyValue=k;exports.fontSize=v;exports.generateColorSystemCSS=D;exports.generateStylesCSS=M;exports.quoteFontName=x;exports.resolveTheme=H;exports.semanticColors=p;exports.shadow=b;exports.spacing=F;exports.spacingPx=_;
78
+ `}function O(){return Object.keys(p).map(r=>` --color-${r}: var(--${r});`).join(`
79
+ `)}function P(r={}){const{includeBaseLayer:n=!1,scope:t}=r,s=F(r.darkSelector),e=["/* Auto-generated by @posthog/quill-tokens — do not edit manually */","",`@custom-variant dark (${`&:is(${s}, ${s} *)`});`];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(O()),e.push(""),e.push(" /* --- Spacing --- */"),e.push(D()),e.push(""),e.push(" /* --- Font sizes --- */"),e.push(I()),e.push(""),e.push(" /* --- Font families --- */"),e.push(M()),e.push(""),e.push(" /* --- Shadows --- */"),e.push(_()),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 {"),t?(e.push(` ${t}, ${t} * {`),e.push(" @apply border-border outline-ring/50;"),e.push(" }")):(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(`
80
+ `)}const z={none:"0px",sm:"4px",md:"6px",lg:"8px",xl:"12px",full:"9999px"};exports.DEFAULT_THEME=w;exports.SPACING_BASE=v;exports.SPACING_BASE_REM=m;exports.borderRadius=z;exports.buildSemanticColors=C;exports.cssVars=b;exports.cssVarsFlat=c;exports.fontFamily=T;exports.fontFamilyValue=y;exports.fontSize=E;exports.generateColorSystemCSS=B;exports.generateStylesCSS=P;exports.quoteFontName=x;exports.resolveTheme=N;exports.semanticColors=p;exports.shadow=S;exports.spacing=A;exports.spacingPx=H;
package/dist/index.js CHANGED
@@ -1,120 +1,120 @@
1
- function x(r, o, e = " ") {
2
- return Object.entries(r).map(([s, u]) => `${e}--${o}-${s}: ${u};`).join(`
1
+ function v(r, n, t = " ") {
2
+ return Object.entries(r).map(([s, l]) => `${t}--${n}-${s}: ${l};`).join(`
3
3
  `);
4
4
  }
5
- function p(r, o = " ") {
6
- return Object.entries(r).map(([e, s]) => `${o}--${e}: ${s};`).join(`
5
+ function h(r, n = " ") {
6
+ return Object.entries(r).map(([t, s]) => `${n}--${t}: ${s};`).join(`
7
7
  `);
8
8
  }
9
- function k(r) {
9
+ function S(r) {
10
10
  return /\s/.test(r) ? `"${r}"` : r;
11
11
  }
12
- function b(r) {
13
- return r.map(k).join(", ");
12
+ function E(r) {
13
+ return r.map(S).join(", ");
14
14
  }
15
- const v = {
15
+ const w = {
16
16
  sm: "0 1px 2px 0 rgba(0, 0, 0, 0.3)",
17
17
  md: "0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3)",
18
18
  lg: "0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3)"
19
19
  };
20
- function y() {
21
- return x(v, "shadow");
20
+ function T() {
21
+ return v(w, "shadow");
22
22
  }
23
- const d = 0.25, $ = `${d}rem`, S = 16;
24
- function A(r) {
25
- return `${d * r}rem`;
23
+ const f = 0.25, V = `${f}rem`, O = 16;
24
+ function I(r) {
25
+ return `${f * r}rem`;
26
26
  }
27
- function D(r) {
28
- return d * r * S;
27
+ function M(r) {
28
+ return f * r * O;
29
29
  }
30
- function E() {
31
- return ` --spacing: ${$};`;
30
+ function j() {
31
+ return ` --spacing: ${V};`;
32
32
  }
33
- const T = 16;
34
- function n(r) {
35
- return `${r / T}rem`;
33
+ const C = 16;
34
+ function a(r) {
35
+ return `${r / C}rem`;
36
36
  }
37
- const w = {
38
- xxs: [n(10), { lineHeight: n(12) }],
37
+ const _ = {
38
+ xxs: [a(10), { lineHeight: a(12) }],
39
39
  // 0.625rem (10px), 0.75rem (12px)
40
- xs: [n(12), { lineHeight: n(16) }],
40
+ xs: [a(12), { lineHeight: a(16) }],
41
41
  // 0.75rem (12px), 1rem (16px)
42
- sm: [n(14), { lineHeight: n(20) }],
42
+ sm: [a(14), { lineHeight: a(20) }],
43
43
  // 0.875rem (14px), 1.25rem (20px)
44
- base: [n(16), { lineHeight: n(24) }],
44
+ base: [a(16), { lineHeight: a(24) }],
45
45
  // 1rem (16px), 1.5rem (24px)
46
- lg: [n(18), { lineHeight: n(28) }],
46
+ lg: [a(18), { lineHeight: a(28) }],
47
47
  // 1.125rem (18px), 1.75rem (28px)
48
- xl: [n(20), { lineHeight: n(28) }],
48
+ xl: [a(20), { lineHeight: a(28) }],
49
49
  // 1.25rem (20px), 1.75rem (28px)
50
- "2xl": [n(24), { lineHeight: n(32) }]
50
+ "2xl": [a(24), { lineHeight: a(32) }]
51
51
  // 1.5rem (24px), 2rem (32px)
52
- }, j = {
52
+ }, F = {
53
53
  sans: ["-apple-system", "BlinkMacSystemFont", "Inter", "Segoe UI", "Roboto", "Helvetica Neue", "sans-serif"],
54
54
  mono: ["JetBrains Mono", "Fira Code", "monospace"]
55
55
  };
56
- function C() {
57
- return Object.entries(w).map(([r, [o, { lineHeight: e }]]) => ` --text-${r}: ${o};
58
- --text-${r}--line-height: ${e};`).join(`
56
+ function H() {
57
+ return Object.entries(_).map(([r, [n, { lineHeight: t }]]) => ` --text-${r}: ${n};
58
+ --text-${r}--line-height: ${t};`).join(`
59
59
  `);
60
60
  }
61
- function O() {
62
- return Object.entries(j).map(([r, o]) => ` --font-${r}: ${b(o)};`).join(`
61
+ function A() {
62
+ return Object.entries(F).map(([r, n]) => ` --font-${r}: ${E(n)};`).join(`
63
63
  `);
64
64
  }
65
- const V = {
65
+ const D = {
66
66
  hue: 90,
67
67
  darkHue: 264,
68
68
  tint: 6e-3,
69
69
  primaryLight: "oklch(0.65 0.21 37.41)",
70
70
  primaryDark: "oklch(0.83 0.16 84.71)"
71
71
  };
72
- function a(r, o, e, s) {
73
- const u = e === "light" ? "var(--theme-hue)" : "var(--theme-dark-hue)", i = o === 1 ? "var(--theme-tint)" : o === 0 ? "0" : `calc(var(--theme-tint) * ${o})`;
74
- return `oklch(${r} ${i} ${u})`;
72
+ function i(r, n, t, s) {
73
+ const l = t === "light" ? "var(--theme-hue)" : "var(--theme-dark-hue)", e = n === 1 ? "var(--theme-tint)" : n === 0 ? "0" : `calc(var(--theme-tint) * ${n})`;
74
+ return `oklch(${r} ${e} ${l})`;
75
75
  }
76
- function t(r, o, e, s) {
77
- return s !== void 0 ? `oklch(${r} ${o} ${e} / ${s * 100}%)` : `oklch(${r} ${o} ${e})`;
76
+ function o(r, n, t, s) {
77
+ return s !== void 0 ? `oklch(${r} ${n} ${t} / ${s * 100}%)` : `oklch(${r} ${n} ${t})`;
78
78
  }
79
- function _() {
79
+ function R() {
80
80
  return {
81
81
  // ── Surfaces (theme-derived) ──────────────────
82
- background: [a(0.97, 1, "light"), a(0.145, 1.5, "dark"), "bg-background"],
83
- foreground: [t(0.13, 0.028, 262), t(0.967, 3e-3, 265), "text-foreground"],
84
- card: [a(0.995, 0.3, "light"), a(0.2, 1.2, "dark"), "bg-card"],
85
- "card-foreground": [t(0.13, 0.028, 262), t(0.967, 3e-3, 265), "text-card-foreground"],
86
- popover: [a(0.995, 0.3, "light"), a(0.21, 1.2, "dark"), "bg-popover"],
87
- "popover-foreground": [t(0.13, 0.028, 262), t(0.967, 3e-3, 265), "text-popover-foreground"],
88
- muted: [a(0.94, 1.5, "light"), a(0.27, 1.5, "dark"), "bg-muted"],
89
- "muted-foreground": [t(0.446, 0.03, 257), t(0.709, 0, 0), "text-muted-foreground"],
90
- accent: [a(0.87, 0.8, "light"), a(0.35, 1.2, "dark"), "bg-accent"],
91
- "accent-foreground": [t(0.13, 0.028, 262), t(0.967, 3e-3, 265), "text-accent-foreground"],
82
+ background: [i(0.97, 1, "light"), i(0.145, 1.5, "dark"), "bg-background"],
83
+ foreground: [o(0.13, 0.028, 262), o(0.967, 3e-3, 265), "text-foreground"],
84
+ card: [i(0.995, 0.3, "light"), i(0.2, 1.2, "dark"), "bg-card"],
85
+ "card-foreground": [o(0.13, 0.028, 262), o(0.967, 3e-3, 265), "text-card-foreground"],
86
+ popover: [i(0.995, 0.3, "light"), i(0.21, 1.2, "dark"), "bg-popover"],
87
+ "popover-foreground": [o(0.13, 0.028, 262), o(0.967, 3e-3, 265), "text-popover-foreground"],
88
+ muted: [i(0.94, 1.5, "light"), i(0.27, 1.5, "dark"), "bg-muted"],
89
+ "muted-foreground": [o(0.446, 0.03, 257), o(0.709, 0, 0), "text-muted-foreground"],
90
+ accent: [i(0.87, 0.8, "light"), i(0.35, 1.2, "dark"), "bg-accent"],
91
+ "accent-foreground": [o(0.13, 0.028, 262), o(0.967, 3e-3, 265), "text-accent-foreground"],
92
92
  // ── Brand (driven by --primary-light / --primary-dark) ─
93
93
  primary: ["var(--primary-light)", "var(--primary-dark)", "bg-primary"],
94
- "primary-foreground": [t(1, 0, 0), t(0.13, 0.028, 262), "text-primary-foreground"],
95
- secondary: [t(0.31, 0, 0), t(0.86, 0, 0), "bg-secondary"],
96
- "secondary-foreground": [t(1, 0, 0), t(0.13, 0.028, 262), "text-secondary-foreground"],
94
+ "primary-foreground": [o(1, 0, 0), o(0.13, 0.028, 262), "text-primary-foreground"],
95
+ secondary: [o(0.31, 0, 0), o(0.86, 0, 0), "bg-secondary"],
96
+ "secondary-foreground": [o(1, 0, 0), o(0.13, 0.028, 262), "text-secondary-foreground"],
97
97
  // ── Status (independent of theme hue) ─────────
98
- destructive: [t(0.92, 0.03, 32.22), t(0.24, 0.03, 2.79), "bg-destructive"],
98
+ destructive: [o(0.92, 0.03, 32.22), o(0.24, 0.03, 2.79), "bg-destructive"],
99
99
  "destructive-foreground": [
100
- t(0.59, 0.2, 23.61),
101
- t(0.6316, 0.1927, 24.53),
100
+ o(0.59, 0.2, 23.61),
101
+ o(0.6316, 0.1927, 24.53),
102
102
  "text-destructive-foreground"
103
103
  ],
104
- success: [t(0.94, 0.06, 154.03), t(0.27, 0.04, 157.6), "bg-success"],
104
+ success: [o(0.94, 0.06, 154.03), o(0.27, 0.04, 157.6), "bg-success"],
105
105
  "success-foreground": [
106
- t(0.448, 0.119, 151.328),
107
- t(0.925, 0.084, 155.995),
106
+ o(0.448, 0.119, 151.328),
107
+ o(0.925, 0.084, 155.995),
108
108
  "text-success-foreground"
109
109
  ],
110
- warning: [t(0.93, 0.04, 74.41), t(0.29, 0.03, 75), "bg-warning"],
111
- "warning-foreground": [t(0.476, 0.114, 61.907), t(0.77, 0.14, 99.29), "text-warning-foreground"],
112
- info: [t(0.882, 0.059, 254.128), t(0.4242, 0.1982, 265.5, 0.4), "bg-info"],
113
- "info-foreground": [t(0.49, 0.02, 254), t(0.882, 0.059, 254.128), "text-info-foreground"],
110
+ warning: [o(0.93, 0.04, 74.41), o(0.29, 0.03, 75), "bg-warning"],
111
+ "warning-foreground": [o(0.476, 0.114, 61.907), o(0.77, 0.14, 99.29), "text-warning-foreground"],
112
+ info: [o(0.882, 0.059, 254.128), o(0.4242, 0.1982, 265.5, 0.4), "bg-info"],
113
+ "info-foreground": [o(0.49, 0.02, 254), o(0.882, 0.059, 254.128), "text-info-foreground"],
114
114
  // ── Borders & rings (theme-derived) ───────────
115
- border: [a(0.9, 0.8, "light"), a(0.27, 1.2, "dark"), "border-border"],
116
- input: [a(0.81, 0.5, "light"), a(0.3, 1.5, "dark"), "border-input"],
117
- ring: [t(0.446, 0.03, 257), t(0.709, 0, 0), "border-ring"],
115
+ border: [i(0.9, 0.8, "light"), i(0.27, 1.2, "dark"), "border-border"],
116
+ input: [i(0.81, 0.5, "light"), i(0.3, 1.5, "dark"), "border-input"],
117
+ ring: [o(0.446, 0.03, 257), o(0.709, 0, 0), "border-ring"],
118
118
  // ── Interactive fills for default button/ interactive elements ───────────
119
119
  // Darkest fill in light mode, lightest in dark mode
120
120
  "fill-expanded": [
@@ -136,12 +136,12 @@ function _() {
136
136
  ]
137
137
  };
138
138
  }
139
- const l = _();
140
- function R(r) {
141
- const o = r === "light" ? 0 : 1;
142
- return Object.fromEntries(Object.entries(l).map(([e, s]) => [e, s[o]]));
139
+ const g = R();
140
+ function N(r) {
141
+ const n = r === "light" ? 0 : 1;
142
+ return Object.fromEntries(Object.entries(g).map(([t, s]) => [t, s[n]]));
143
143
  }
144
- const m = /* @__PURE__ */ new Set([
144
+ const x = /* @__PURE__ */ new Set([
145
145
  "background",
146
146
  "card",
147
147
  "popover",
@@ -153,62 +153,104 @@ const m = /* @__PURE__ */ new Set([
153
153
  // Transitive: reference var(--accent) / var(--muted) — must also live
154
154
  // on `*` to re-evaluate on local overrides.
155
155
  "fill-hover",
156
- "fill-active",
157
156
  "fill-expanded",
158
157
  "fill-selected"
159
158
  ]);
160
- function F(r) {
161
- const o = [
159
+ function q(r) {
160
+ const n = [
162
161
  "var(--theme-hue)",
163
162
  "var(--theme-dark-hue)",
164
163
  "var(--theme-tint)",
165
164
  "var(--primary-light)",
166
165
  "var(--primary-dark)"
167
166
  ];
168
- for (const [e, [s, u]] of Object.entries(r))
169
- if (o.some((c) => s.includes(c) || u.includes(c)) && !m.has(e))
167
+ for (const [t, [s, l]] of Object.entries(r))
168
+ if (n.some((c) => s.includes(c) || l.includes(c)) && !x.has(t))
170
169
  throw new Error(
171
- `[@posthog/quill-tokens] Token "${e}" references a theme variable but is missing from THEME_DERIVED_TOKENS. Add it to the set in colors.ts or local [--theme-hue:X] overrides will silently fail for this token.`
170
+ `[@posthog/quill-tokens] Token "${t}" references a theme variable but is missing from THEME_DERIVED_TOKENS. Add it to the set in colors.ts or local [--theme-hue:X] overrides will silently fail for this token.`
172
171
  );
173
172
  }
174
- F(l);
175
- function I(r = V) {
176
- const o = (i = " ") => [
177
- `${i}--theme-hue: ${r.hue};`,
178
- `${i}--theme-dark-hue: ${r.darkHue};`,
179
- `${i}--theme-tint: ${r.tint};`,
180
- `${i}--primary-light: ${r.primaryLight};`,
181
- `${i}--primary-dark: ${r.primaryDark};`
173
+ q(g);
174
+ function b(r) {
175
+ const t = r === void 0 ? [".dark", '[theme="dark"]'] : typeof r == "string" ? [r] : r;
176
+ return t.length === 1 ? t[0] : `:is(${t.join(", ")})`;
177
+ }
178
+ function B(r = D, n = {}) {
179
+ const { scope: t } = n, s = b(n.darkSelector), l = (u = " ") => [
180
+ `${u}--radius: 0.625rem;`,
181
+ `${u}--theme-hue: ${r.hue};`,
182
+ `${u}--theme-dark-hue: ${r.darkHue};`,
183
+ `${u}--theme-tint: ${r.tint};`,
184
+ `${u}--primary-light: ${r.primaryLight};`,
185
+ `${u}--primary-dark: ${r.primaryDark};`
182
186
  ].join(`
183
- `), e = (i) => {
184
- const c = {}, g = {};
185
- for (const [h, f] of Object.entries(l))
186
- m.has(h) ? g[h] = f[i] : c[h] = f[i];
187
- return { staticVars: c, dynamicVars: g };
188
- }, s = e(0), u = e(1);
187
+ `), e = (u) => {
188
+ const d = {}, $ = {};
189
+ for (const [m, k] of Object.entries(g))
190
+ x.has(m) ? $[m] = k[u] : d[m] = k[u];
191
+ return { staticVars: d, dynamicVars: $ };
192
+ }, c = e(0), p = e(1);
193
+ if (t) {
194
+ const u = `:is(${t}, ${t} *)`, d = `:is(${s} ${t}, ${t}${s}, ${s} ${t} *, ${t}${s} *)`;
195
+ return `/* Auto-generated by @posthog/quill-tokens — do not edit manually */
196
+
197
+ /*
198
+ * Scoped output — all token vars are gated behind \`${t}\` so they
199
+ * do not clash with the consumer's existing CSS custom properties.
200
+ * Add the \`${t.replace(/[[\]]/g, "")}\` attribute to wrapper elements
201
+ * where quill components are rendered.
202
+ *
203
+ * Dark mode: works when the dark selector is on an ancestor of the scope
204
+ * element (.dark > [data-quill]) OR on the scope element itself
205
+ * ([data-quill].dark).
206
+ */
207
+ ${t} {
208
+ color-scheme: light;
209
+ }
210
+
211
+ :is(${s} ${t}, ${t}${s}) {
212
+ color-scheme: dark;
213
+ }
214
+
215
+ ${u} {
216
+ ${l()}
217
+ ${h(c.staticVars)}
218
+ ${h(c.dynamicVars)}
219
+
220
+ /* Override Tailwind --color-* theme tokens within scope so utilities
221
+ * like bg-accent, text-foreground, border-border resolve to quill's
222
+ * values instead of the consumer's global theme. */
223
+ ${y()}
224
+ }
225
+
226
+ ${d} {
227
+ ${h(p.staticVars)}
228
+ ${h(p.dynamicVars)}
229
+ }
230
+ `;
231
+ }
189
232
  return `/* Auto-generated by @posthog/quill-tokens — do not edit manually */
190
233
 
191
234
  :root {
192
235
  color-scheme: light;
193
236
  }
194
237
 
195
- .dark {
238
+ ${s} {
196
239
  color-scheme: dark;
197
240
  }
198
241
 
199
242
  /* Theme knobs — override these to shift the palette */
200
243
  :root {
201
- --radius: 0.625rem;
202
- ${o()}
244
+ ${l()}
203
245
  }
204
246
 
205
247
  /* Static colors (no theme-var references, safe on :root) */
206
248
  :root {
207
- ${p(s.staticVars)}
249
+ ${h(c.staticVars)}
208
250
  }
209
251
 
210
- .dark {
211
- ${p(u.staticVars)}
252
+ ${s} {
253
+ ${h(p.staticVars)}
212
254
  }
213
255
 
214
256
  /*
@@ -217,28 +259,28 @@ ${p(u.staticVars)}
217
259
  * This enables local overrides like [--theme-hue:200] on a container.
218
260
  */
219
261
  * {
220
- ${p(s.dynamicVars)}
262
+ ${h(c.dynamicVars)}
221
263
  }
222
264
 
223
- :is(.dark, .dark *) {
224
- ${p(u.dynamicVars)}
265
+ :is(${s}, ${s} *) {
266
+ ${h(p.dynamicVars)}
225
267
  }
226
268
  `;
227
269
  }
228
- function H() {
229
- return Object.keys(l).map((r) => ` --color-${r}: var(--${r});`).join(`
270
+ function y() {
271
+ return Object.keys(g).map((r) => ` --color-${r}: var(--${r});`).join(`
230
272
  `);
231
273
  }
232
- function M(r = {}) {
233
- const { includeBaseLayer: o = !1 } = r, e = [
274
+ function X(r = {}) {
275
+ const { includeBaseLayer: n = !1, scope: t } = r, s = b(r.darkSelector), e = [
234
276
  "/* Auto-generated by @posthog/quill-tokens — do not edit manually */",
235
277
  "",
236
- "@custom-variant dark (&:is(.dark, .dark *));"
278
+ `@custom-variant dark (${`&:is(${s}, ${s} *)`});`
237
279
  ];
238
- 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(H()), e.push(""), e.push(" /* --- Spacing --- */"), e.push(E()), e.push(""), e.push(" /* --- Font sizes --- */"), e.push(C()), e.push(""), e.push(" /* --- Font families --- */"), e.push(O()), e.push(""), e.push(" /* --- Shadows --- */"), e.push(y()), 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("}"), o && (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(`
280
+ 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(j()), e.push(""), e.push(" /* --- Font sizes --- */"), e.push(H()), e.push(""), e.push(" /* --- Font families --- */"), e.push(A()), e.push(""), e.push(" /* --- Shadows --- */"), e.push(T()), 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 {"), t ? (e.push(` ${t}, ${t} * {`), e.push(" @apply border-border outline-ring/50;"), e.push(" }")) : (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(`
239
281
  `);
240
282
  }
241
- const N = {
283
+ const z = {
242
284
  none: "0px",
243
285
  sm: "4px",
244
286
  md: "6px",
@@ -247,22 +289,22 @@ const N = {
247
289
  full: "9999px"
248
290
  };
249
291
  export {
250
- V as DEFAULT_THEME,
251
- $ as SPACING_BASE,
252
- d as SPACING_BASE_REM,
253
- N as borderRadius,
254
- _ as buildSemanticColors,
255
- x as cssVars,
256
- p as cssVarsFlat,
257
- j as fontFamily,
258
- b as fontFamilyValue,
259
- w as fontSize,
260
- I as generateColorSystemCSS,
261
- M as generateStylesCSS,
262
- k as quoteFontName,
263
- R as resolveTheme,
264
- l as semanticColors,
265
- v as shadow,
266
- A as spacing,
267
- D as spacingPx
292
+ D as DEFAULT_THEME,
293
+ V as SPACING_BASE,
294
+ f as SPACING_BASE_REM,
295
+ z as borderRadius,
296
+ R as buildSemanticColors,
297
+ v as cssVars,
298
+ h as cssVarsFlat,
299
+ F as fontFamily,
300
+ E as fontFamilyValue,
301
+ _ as fontSize,
302
+ B as generateColorSystemCSS,
303
+ X as generateStylesCSS,
304
+ S as quoteFontName,
305
+ N as resolveTheme,
306
+ g as semanticColors,
307
+ w as shadow,
308
+ I as spacing,
309
+ M as spacingPx
268
310
  };
@@ -1,6 +1,6 @@
1
1
  /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
2
 
3
- @custom-variant dark (&:is(.dark, .dark *));
3
+ @custom-variant dark (&:is(:is(.dark, [theme="dark"]), :is(.dark, [theme="dark"]) *));
4
4
 
5
5
  @theme inline {
6
6
  --animate-skeleton: skeleton 2s -1s infinite linear;
@@ -0,0 +1,101 @@
1
+ /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
+
3
+ @custom-variant dark (&:is(:is(.dark, [theme="dark"]), :is(.dark, [theme="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-muted: var(--muted);
19
+ --color-muted-foreground: var(--muted-foreground);
20
+ --color-accent: var(--accent);
21
+ --color-accent-foreground: var(--accent-foreground);
22
+ --color-primary: var(--primary);
23
+ --color-primary-foreground: var(--primary-foreground);
24
+ --color-secondary: var(--secondary);
25
+ --color-secondary-foreground: var(--secondary-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-expanded: var(--fill-expanded);
38
+ --color-fill-selected: var(--fill-selected);
39
+ --color-fill-hover: var(--fill-hover);
40
+
41
+ /* --- Spacing --- */
42
+ --spacing: 0.25rem;
43
+
44
+ /* --- Font sizes --- */
45
+ --text-xxs: 0.625rem;
46
+ --text-xxs--line-height: 0.75rem;
47
+ --text-xs: 0.75rem;
48
+ --text-xs--line-height: 1rem;
49
+ --text-sm: 0.875rem;
50
+ --text-sm--line-height: 1.25rem;
51
+ --text-base: 1rem;
52
+ --text-base--line-height: 1.5rem;
53
+ --text-lg: 1.125rem;
54
+ --text-lg--line-height: 1.75rem;
55
+ --text-xl: 1.25rem;
56
+ --text-xl--line-height: 1.75rem;
57
+ --text-2xl: 1.5rem;
58
+ --text-2xl--line-height: 2rem;
59
+
60
+ /* --- Font families --- */
61
+ --font-sans: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
62
+ --font-mono: "JetBrains Mono", "Fira Code", monospace;
63
+
64
+ /* --- Shadows --- */
65
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
66
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
67
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
68
+
69
+ /* --- Radius (derived from --radius base) --- */
70
+ --radius-sm: calc(var(--radius) - 4px);
71
+ --radius-md: calc(var(--radius) - 2px);
72
+ --radius-lg: var(--radius);
73
+ --radius-xl: calc(var(--radius) + 4px);
74
+ --radius-2xl: calc(var(--radius) + 8px);
75
+ --radius-3xl: calc(var(--radius) + 12px);
76
+ --radius-4xl: calc(var(--radius) + 16px);
77
+
78
+ @keyframes skeleton {
79
+ to {
80
+ background-position: -200% 0;
81
+ }
82
+ }
83
+
84
+ @keyframes pulse-glow {
85
+ 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }
86
+ 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }
87
+ }
88
+
89
+ @keyframes horizontal-shake {
90
+ 0% { transform: translateX(0); }
91
+ 25% { transform: translateX(5px); }
92
+ 50% { transform: translateX(-5px); }
93
+ 75% { transform: translateX(2px); }
94
+ 100% { transform: translateX(0); }
95
+ }
96
+
97
+ @keyframes radar {
98
+ 0% { transform: scale(1); opacity: 0.5; }
99
+ 100% { transform: scale(1.5); opacity: 0; }
100
+ }
101
+ }
package/dist/tailwind.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
2
 
3
- @custom-variant dark (&:is(.dark, .dark *));
3
+ @custom-variant dark (&:is(:is(.dark, [theme="dark"]), :is(.dark, [theme="dark"]) *));
4
4
 
5
5
  @theme inline {
6
6
  --animate-skeleton: skeleton 2s -1s infinite linear;
@@ -0,0 +1,107 @@
1
+ /* Auto-generated by @posthog/quill-tokens — do not edit manually */
2
+
3
+ @custom-variant dark (&:is(:is(.dark, [theme="dark"]), :is(.dark, [theme="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-muted: var(--muted);
19
+ --color-muted-foreground: var(--muted-foreground);
20
+ --color-accent: var(--accent);
21
+ --color-accent-foreground: var(--accent-foreground);
22
+ --color-primary: var(--primary);
23
+ --color-primary-foreground: var(--primary-foreground);
24
+ --color-secondary: var(--secondary);
25
+ --color-secondary-foreground: var(--secondary-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-expanded: var(--fill-expanded);
38
+ --color-fill-selected: var(--fill-selected);
39
+ --color-fill-hover: var(--fill-hover);
40
+
41
+ /* --- Spacing --- */
42
+ --spacing: 0.25rem;
43
+
44
+ /* --- Font sizes --- */
45
+ --text-xxs: 0.625rem;
46
+ --text-xxs--line-height: 0.75rem;
47
+ --text-xs: 0.75rem;
48
+ --text-xs--line-height: 1rem;
49
+ --text-sm: 0.875rem;
50
+ --text-sm--line-height: 1.25rem;
51
+ --text-base: 1rem;
52
+ --text-base--line-height: 1.5rem;
53
+ --text-lg: 1.125rem;
54
+ --text-lg--line-height: 1.75rem;
55
+ --text-xl: 1.25rem;
56
+ --text-xl--line-height: 1.75rem;
57
+ --text-2xl: 1.5rem;
58
+ --text-2xl--line-height: 2rem;
59
+
60
+ /* --- Font families --- */
61
+ --font-sans: -apple-system, BlinkMacSystemFont, Inter, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
62
+ --font-mono: "JetBrains Mono", "Fira Code", monospace;
63
+
64
+ /* --- Shadows --- */
65
+ --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
66
+ --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
67
+ --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
68
+
69
+ /* --- Radius (derived from --radius base) --- */
70
+ --radius-sm: calc(var(--radius) - 4px);
71
+ --radius-md: calc(var(--radius) - 2px);
72
+ --radius-lg: var(--radius);
73
+ --radius-xl: calc(var(--radius) + 4px);
74
+ --radius-2xl: calc(var(--radius) + 8px);
75
+ --radius-3xl: calc(var(--radius) + 12px);
76
+ --radius-4xl: calc(var(--radius) + 16px);
77
+
78
+ @keyframes skeleton {
79
+ to {
80
+ background-position: -200% 0;
81
+ }
82
+ }
83
+
84
+ @keyframes pulse-glow {
85
+ 0%, 100% { box-shadow: 0 0 2px 1px var(--pulse-glow-color, var(--color-accent)) }
86
+ 50% { box-shadow: 0 0 6px 2px var(--pulse-glow-color, var(--color-accent)) }
87
+ }
88
+
89
+ @keyframes horizontal-shake {
90
+ 0% { transform: translateX(0); }
91
+ 25% { transform: translateX(5px); }
92
+ 50% { transform: translateX(-5px); }
93
+ 75% { transform: translateX(2px); }
94
+ 100% { transform: translateX(0); }
95
+ }
96
+
97
+ @keyframes radar {
98
+ 0% { transform: scale(1); opacity: 0.5; }
99
+ 100% { transform: scale(1.5); opacity: 0; }
100
+ }
101
+ }
102
+
103
+ @layer base {
104
+ [data-quill], [data-quill] * {
105
+ @apply border-border outline-ring/50;
106
+ }
107
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/quill-tokens",
3
- "version": "0.1.0-alpha.7",
3
+ "version": "0.1.2-alpha.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,7 +24,10 @@
24
24
  },
25
25
  "./tailwind.css": "./dist/tailwind.css",
26
26
  "./tailwind-lib.css": "./dist/tailwind-lib.css",
27
- "./color-system.css": "./dist/color-system.css"
27
+ "./color-system.css": "./dist/color-system.css",
28
+ "./tailwind.scoped.css": "./dist/tailwind.scoped.css",
29
+ "./tailwind-lib.scoped.css": "./dist/tailwind-lib.scoped.css",
30
+ "./color-system.scoped.css": "./dist/color-system.scoped.css"
28
31
  },
29
32
  "publishConfig": {
30
33
  "access": "public"
package/src/build.ts CHANGED
@@ -30,3 +30,20 @@ writeFileSync(resolve(distDir, 'tailwind.css'), generateStylesCSS({ includeBaseL
30
30
 
31
31
  // 3. Library stylesheet (@theme only, no base layer)
32
32
  writeFileSync(resolve(distDir, 'tailwind-lib.css'), generateStylesCSS({ includeBaseLayer: false }))
33
+
34
+ // 4. Scoped variants for consumers with existing design systems.
35
+ // Vars are gated behind [data-quill] so they don't clash with
36
+ // the consumer's CSS custom properties (e.g. --border, --accent).
37
+ const scopedOpts = { scope: '[data-quill]' }
38
+
39
+ writeFileSync(resolve(distDir, 'color-system.scoped.css'), generateColorSystemCSS(undefined, scopedOpts))
40
+
41
+ writeFileSync(
42
+ resolve(distDir, 'tailwind.scoped.css'),
43
+ generateStylesCSS({ includeBaseLayer: true, ...scopedOpts })
44
+ )
45
+
46
+ writeFileSync(
47
+ resolve(distDir, 'tailwind-lib.scoped.css'),
48
+ generateStylesCSS({ includeBaseLayer: false, ...scopedOpts })
49
+ )
package/src/colors.ts CHANGED
@@ -164,6 +164,26 @@ export const semanticColors = buildSemanticColors()
164
164
  export interface StylesConfig {
165
165
  /** Include @layer base reset rules (apps only) */
166
166
  includeBaseLayer?: boolean
167
+ /**
168
+ * CSS selector to scope all token CSS vars to. When set, vars are only
169
+ * defined inside elements matching this selector, preventing clashes
170
+ * with the consumer's existing CSS custom properties.
171
+ *
172
+ * Example: `'[data-quill]'` — consumer adds `data-quill` to wrapper
173
+ * elements. During migration the attribute moves up the DOM tree;
174
+ * when it reaches `<html>` the scope is effectively global and can
175
+ * be removed.
176
+ */
177
+ scope?: string
178
+ /**
179
+ * CSS selector(s) for dark mode. Accepts a single selector or an
180
+ * array — when multiple are given they are combined with `:is()`
181
+ * so any of them activates dark mode.
182
+ *
183
+ * Default: `['.dark', '[theme="dark"]']` (both `.dark` class and
184
+ * `theme="dark"` attribute work out of the box).
185
+ */
186
+ darkSelector?: string | string[]
167
187
  }
168
188
 
169
189
  // ── Helpers ───────────────────────────────────────────
@@ -196,7 +216,6 @@ const THEME_DERIVED_TOKENS: ReadonlySet<string> = new Set([
196
216
  // Transitive: reference var(--accent) / var(--muted) — must also live
197
217
  // on `*` to re-evaluate on local overrides.
198
218
  'fill-hover',
199
- 'fill-active',
200
219
  'fill-expanded',
201
220
  'fill-selected',
202
221
  ])
@@ -233,10 +252,24 @@ function assertThemeDerivedSyncedWithColors(colors: Record<string, ColorTuple>):
233
252
 
234
253
  assertThemeDerivedSyncedWithColors(semanticColors)
235
254
 
255
+ /** Normalize darkSelector option into a single CSS selector string. */
256
+ function resolveDarkSelector(raw?: string | string[]): string {
257
+ const defaults = ['.dark', '[theme="dark"]']
258
+ const selectors = raw === undefined ? defaults : typeof raw === 'string' ? [raw] : raw
259
+ return selectors.length === 1 ? selectors[0] : `:is(${selectors.join(', ')})`
260
+ }
261
+
236
262
  /** Generate color-system.css (:root light + .dark overrides) */
237
- export function generateColorSystemCSS(theme: ThemeConfig = DEFAULT_THEME): string {
238
- const themeVars = (indent = ' '): string =>
263
+ export function generateColorSystemCSS(
264
+ theme: ThemeConfig = DEFAULT_THEME,
265
+ opts: Pick<StylesConfig, 'scope' | 'darkSelector'> = {}
266
+ ): string {
267
+ const { scope } = opts
268
+ const darkSelector = resolveDarkSelector(opts.darkSelector)
269
+
270
+ const themeKnobs = (indent = ' '): string =>
239
271
  [
272
+ `${indent}--radius: 0.625rem;`,
240
273
  `${indent}--theme-hue: ${theme.hue};`,
241
274
  `${indent}--theme-dark-hue: ${theme.darkHue};`,
242
275
  `${indent}--theme-tint: ${theme.tint};`,
@@ -261,20 +294,68 @@ export function generateColorSystemCSS(theme: ThemeConfig = DEFAULT_THEME): stri
261
294
  const light = partition(0)
262
295
  const dark = partition(1)
263
296
 
297
+ // ── Scoped mode ─────────────────────────────────────
298
+ // All vars gated behind the scope selector to avoid clashing
299
+ // with the consumer's existing CSS custom properties.
300
+ if (scope) {
301
+ const scopeSel = `:is(${scope}, ${scope} *)`
302
+ // Handle both ancestor-dark (`.dark [data-quill]`) and same-element
303
+ // dark (`[data-quill].dark`) so dark mode works regardless of where
304
+ // the dark selector lives relative to the scope element.
305
+ const darkScopeSel = `:is(${darkSelector} ${scope}, ${scope}${darkSelector}, ${darkSelector} ${scope} *, ${scope}${darkSelector} *)`
306
+
307
+ return `/* Auto-generated by @posthog/quill-tokens — do not edit manually */
308
+
309
+ /*
310
+ * Scoped output — all token vars are gated behind \`${scope}\` so they
311
+ * do not clash with the consumer's existing CSS custom properties.
312
+ * Add the \`${scope.replace(/[[\]]/g, '')}\` attribute to wrapper elements
313
+ * where quill components are rendered.
314
+ *
315
+ * Dark mode: works when the dark selector is on an ancestor of the scope
316
+ * element (.dark > [data-quill]) OR on the scope element itself
317
+ * ([data-quill].dark).
318
+ */
319
+ ${scope} {
320
+ color-scheme: light;
321
+ }
322
+
323
+ :is(${darkSelector} ${scope}, ${scope}${darkSelector}) {
324
+ color-scheme: dark;
325
+ }
326
+
327
+ ${scopeSel} {
328
+ ${themeKnobs()}
329
+ ${cssVarsFlat(light.staticVars)}
330
+ ${cssVarsFlat(light.dynamicVars)}
331
+
332
+ /* Override Tailwind --color-* theme tokens within scope so utilities
333
+ * like bg-accent, text-foreground, border-border resolve to quill's
334
+ * values instead of the consumer's global theme. */
335
+ ${generateColorMappingsCSS()}
336
+ }
337
+
338
+ ${darkScopeSel} {
339
+ ${cssVarsFlat(dark.staticVars)}
340
+ ${cssVarsFlat(dark.dynamicVars)}
341
+ }
342
+ `
343
+ }
344
+
345
+ // ── Unscoped mode (default) ─────────────────────────
264
346
  return `/* Auto-generated by @posthog/quill-tokens — do not edit manually */
265
347
 
266
348
  :root {
267
349
  color-scheme: light;
268
350
  }
269
351
 
270
- .dark {
352
+ ${darkSelector} {
271
353
  color-scheme: dark;
272
354
  }
273
355
 
274
356
  /* Theme knobs — override these to shift the palette */
275
357
  :root {
276
- --radius: 0.625rem;
277
- ${themeVars()}
358
+ ${themeKnobs()}
278
359
  }
279
360
 
280
361
  /* Static colors (no theme-var references, safe on :root) */
@@ -282,7 +363,7 @@ ${themeVars()}
282
363
  ${cssVarsFlat(light.staticVars)}
283
364
  }
284
365
 
285
- .dark {
366
+ ${darkSelector} {
286
367
  ${cssVarsFlat(dark.staticVars)}
287
368
  }
288
369
 
@@ -295,7 +376,7 @@ ${cssVarsFlat(dark.staticVars)}
295
376
  ${cssVarsFlat(light.dynamicVars)}
296
377
  }
297
378
 
298
- :is(.dark, .dark *) {
379
+ :is(${darkSelector}, ${darkSelector} *) {
299
380
  ${cssVarsFlat(dark.dynamicVars)}
300
381
  }
301
382
  `
@@ -323,12 +404,14 @@ function generateColorMappingsCSS(): string {
323
404
  * Used by apps/web, apps/storybook.
324
405
  */
325
406
  export function generateStylesCSS(config: StylesConfig = {}): string {
326
- const { includeBaseLayer = false } = config
407
+ const { includeBaseLayer = false, scope } = config
408
+ const darkSelector = resolveDarkSelector(config.darkSelector)
327
409
 
410
+ const darkVariantBody = `&:is(${darkSelector}, ${darkSelector} *)`
328
411
  const lines: string[] = [
329
412
  '/* Auto-generated by @posthog/quill-tokens — do not edit manually */',
330
413
  '',
331
- '@custom-variant dark (&:is(.dark, .dark *));',
414
+ `@custom-variant dark (${darkVariantBody});`,
332
415
  ]
333
416
  lines.push('')
334
417
 
@@ -391,12 +474,18 @@ export function generateStylesCSS(config: StylesConfig = {}): string {
391
474
  if (includeBaseLayer) {
392
475
  lines.push('')
393
476
  lines.push('@layer base {')
394
- lines.push(' * {')
395
- lines.push(' @apply border-border outline-ring/50;')
396
- lines.push(' }')
397
- lines.push(' body {')
398
- lines.push(' @apply bg-background text-foreground;')
399
- lines.push(' }')
477
+ if (scope) {
478
+ lines.push(` ${scope}, ${scope} * {`)
479
+ lines.push(' @apply border-border outline-ring/50;')
480
+ lines.push(' }')
481
+ } else {
482
+ lines.push(' * {')
483
+ lines.push(' @apply border-border outline-ring/50;')
484
+ lines.push(' }')
485
+ lines.push(' body {')
486
+ lines.push(' @apply bg-background text-foreground;')
487
+ lines.push(' }')
488
+ }
400
489
  lines.push('}')
401
490
  }
402
491