@adea-ai/ui 0.71.5 → 0.72.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/dist/components/theme/theme-picker.d.ts.map +1 -1
- package/dist/components/theme/theme-picker.js +2 -2
- package/dist/components/theme/theme-picker.js.map +1 -1
- package/dist/components/ui/button/button.js +1 -1
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog/dialog.js +1 -1
- package/dist/components/ui/dialog/dialog.js.map +1 -1
- package/dist/lib/themes.d.ts +3 -0
- package/dist/lib/themes.d.ts.map +1 -1
- package/dist/lib/themes.js +6 -7
- package/dist/lib/themes.js.map +1 -1
- package/dist/lib/tokens.d.ts.map +1 -1
- package/dist/lib/tokens.js +14 -2
- package/dist/lib/tokens.js.map +1 -1
- package/dist/r/appearance-editor.json +1 -1
- package/dist/r/lib.json +1 -1
- package/dist/r/registry.json +2 -2
- package/dist/r/src/components/theme/theme-picker.tsx +5 -2
- package/dist/r/src/components/ui/button/button.tsx +1 -1
- package/dist/r/src/components/ui/dialog/dialog.tsx +6 -1
- package/dist/r/src/lib/themes.ts +18 -7
- package/dist/r/src/lib/tokens.ts +15 -2
- package/dist/r/src/styles/theme.css +6 -0
- package/package.json +2 -2
- package/registry.json +2 -2
- package/src/components/theme/theme-picker.tsx +5 -2
- package/src/components/ui/button/button.tsx +1 -1
- package/src/components/ui/dialog/dialog.tsx +6 -1
- package/src/lib/themes.ts +18 -7
- package/src/lib/tokens.ts +15 -2
- package/src/styles/theme.css +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-picker.d.ts","sourceRoot":"","sources":["../../../src/components/theme/theme-picker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAG9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG/C;;;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AK,CAAC,GAAG;IACrD,MAAM,EAAE,SAAS,YAAY,EAAE,CAAA;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAA;CAC7C,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,kCAoClD"}
|
|
@@ -33,7 +33,7 @@ function ThemeSwatch(props) {
|
|
|
33
33
|
colors().card,
|
|
34
34
|
colors().primary,
|
|
35
35
|
colors().accent,
|
|
36
|
-
colors().
|
|
36
|
+
colors().destructiveAction
|
|
37
37
|
];
|
|
38
38
|
},
|
|
39
39
|
children: (color) => (() => {
|
|
@@ -64,7 +64,7 @@ function ThemePreview(props) {
|
|
|
64
64
|
}
|
|
65
65
|
}, rest), false, true);
|
|
66
66
|
effect((_p$) => {
|
|
67
|
-
var _v$ = c().sidebar, _v$2 = c().sidebarBorder, _v$3 = c().primary, _v$4 = c().sidebarAccent, _v$5 = c().sidebarAccent, _v$6 = c().foreground, _v$7 = c().mutedForeground, _v$8 = c().mutedForeground, _v$9 = c().primary, _v$0 = c().
|
|
67
|
+
var _v$ = c().sidebar, _v$2 = c().sidebarBorder, _v$3 = c().primary, _v$4 = c().sidebarAccent, _v$5 = c().sidebarAccent, _v$6 = c().foreground, _v$7 = c().mutedForeground, _v$8 = c().mutedForeground, _v$9 = c().primary, _v$0 = c().destructiveAction, _v$1 = c().secondary;
|
|
68
68
|
_v$ !== _p$.e && setStyleProperty(_el$5, "background-color", _p$.e = _v$);
|
|
69
69
|
_v$2 !== _p$.t && setStyleProperty(_el$5, "--preview-edge", _p$.t = _v$2);
|
|
70
70
|
_v$3 !== _p$.a && setStyleProperty(_el$6, "background-color", _p$.a = _v$3);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-picker.js","names":["ComponentProps","For","Show","splitProps","cn","ThemeVariant","Button","ThemeSwatchProps","theme","size","swatchSizes","sm","md","lg","const","ThemeSwatch","props","local","rest","colors","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","background","card","primary","accent","destructive","children","color","_el$2","_tmpl$2","_$setStyleProperty","_$effect","_$className","ThemePreviewProps","selected","ThemePreview","c","_el$3","_tmpl$3","_el$4","firstChild","_el$5","_el$6","_el$7","nextSibling","_el$8","_el$9","_el$0","_el$1","_el$10","_el$11","_el$12","_el$13","_el$14","style","_p$","_v$","sidebar","_v$2","sidebarBorder","_v$3","_v$4","sidebarAccent","_v$5","_v$6","foreground","_v$7","mutedForeground","_v$8","_v$9","_v$0","_v$1","secondary","e","t","a","o","i","n","s","h","r","d","l","undefined","ThemePickerProps","themes","selectedId","onThemeSelect","ThemePicker","_el$15","_tmpl$4","as","type","variant","role","aria-checked","id","aria-label","familyLabel","label","onClick","_el$16","_tmpl$6","_el$17","when","family","_el$18","_tmpl$5","_$mergeProps","_$createComponent","_$className","_$setStyleProperty"],"sources":["../../../src/components/theme/theme-picker.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport type { ThemeVariant } from '#lib/themes'\nimport { Button } from '../ui/button/button'\n\n/**\n * ThemeSwatch.\n *\n * The colours of a theme, as a small readable strip: the canvas, a card, the\n * primary, an accent and the destructive fill. Enough to tell two dark themes\n * apart at a glance and to recognise the one you want without applying it.\n *\n * A swatch is **read from the variant object**, not from a stylesheet, so a picker\n * can show a theme that is not currently applied — which is the whole point of a\n * picker. That is also why the catalogue is data rather than CSS.\n */\nexport type ThemeSwatchProps = ComponentProps<'span'> & {\n theme: ThemeVariant\n /** Draw the swatch at the given size. */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst swatchSizes = {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n} as const\n\nexport function ThemeSwatch(props: ThemeSwatchProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'size'])\n const colors = () => local.theme.colors\n\n return (\n <span\n data-slot=\"theme-swatch\"\n aria-hidden=\"true\"\n class={cn(\n 'border-border inline-flex shrink-0 overflow-hidden rounded-md border',\n local.class\n )}\n {...rest}\n >\n <For\n each={[\n colors().background,\n colors().card,\n colors().primary,\n colors().accent,\n colors().destructive,\n ]}\n >\n {(color) => (\n <span\n class={cn('block', swatchSizes[local.size ?? 'md'])}\n style={{ 'background-color': color }}\n />\n )}\n </For>\n </span>\n )\n}\n\n/**\n * ThemePreview.\n *\n * A miniature of the interface, painted in a theme's own colours: a rail, a panel,\n * a heading, body text, a primary button and a destructive one.\n *\n * The point is that a colour strip cannot answer the question a user actually has —\n * \"would I want to look at this all day?\" — and a real preview can. It is drawn\n * with inline colours from the variant rather than by applying the theme, so a list\n * of twenty previews costs one object read each instead of twenty theme swaps.\n */\nexport type ThemePreviewProps = ComponentProps<'div'> & {\n theme: ThemeVariant\n /** Highlight the preview as the current selection. */\n selected?: boolean\n}\n\nexport function ThemePreview(props: ThemePreviewProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'selected'])\n const c = () => local.theme.colors\n\n return (\n <div\n data-slot=\"theme-preview\"\n class={cn(\n 'w-44 overflow-hidden rounded-lg border shadow-xs',\n local.selected ? 'border-primary ring-3 ring-primary-subtle' : 'border-border',\n local.class\n )}\n style={{ 'background-color': c().background }}\n {...rest}\n >\n <div class=\"flex h-24\">\n {/* A rail and a panel: the two surfaces a user spends the day looking at. */}\n <div\n class=\"theme-preview-edge flex w-6 flex-col items-center gap-1.5 border-e py-2\"\n style={{ 'background-color': c().sidebar, '--preview-edge': c().sidebarBorder }}\n >\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n </div>\n <div class=\"flex flex-1 flex-col gap-1.5 p-2\">\n <div class=\"h-1.5 w-14 rounded-full\" style={{ 'background-color': c().foreground }} />\n <div class=\"h-1 w-20 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"h-1 w-16 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"mt-auto flex items-center gap-1\">\n <span class=\"h-3 w-9 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().destructive }} />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().secondary }} />\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * ThemePicker.\n *\n * The catalogue as a selectable grid. One appearance at a time — a light picker\n * lists light themes and a dark picker lists dark ones — because choosing a dark\n * theme while looking at a light interface is a choice nobody can evaluate.\n *\n * `onSelect` rather than an internal signal: the selection belongs to the\n * preference the provider owns, and a picker that kept its own copy could disagree\n * with what is applied.\n */\nexport type ThemePickerProps = ComponentProps<'div'> & {\n themes: readonly ThemeVariant[]\n selectedId: string\n onThemeSelect: (theme: ThemeVariant) => void\n}\n\nexport function ThemePicker(props: ThemePickerProps) {\n const [local, rest] = splitProps(props, ['class', 'themes', 'selectedId', 'onThemeSelect'])\n\n return (\n <div\n data-slot=\"theme-picker\"\n role=\"radiogroup\"\n aria-label=\"Theme\"\n class={cn('flex flex-wrap gap-3', local.class)}\n {...rest}\n >\n <For each={local.themes}>\n {(theme) => (\n <Button\n as=\"button\"\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"radio\"\n aria-checked={local.selectedId === theme.id}\n aria-label={`${theme.familyLabel} ${theme.label}`}\n class=\"h-auto flex-col gap-1.5 p-0 hover:bg-transparent\"\n onClick={() => local.onThemeSelect(theme)}\n >\n <ThemePreview theme={theme} selected={local.selectedId === theme.id} />\n <span class=\"flex flex-col items-center\">\n <span class=\"text-xs font-medium\">{theme.label}</span>\n <Show when={theme.family !== 'adea'}>\n <span class=\"text-muted-foreground text-2xs\">{theme.familyLabel}</span>\n </Show>\n </span>\n </Button>\n )}\n </For>\n </div>\n )\n}\n"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G,MAAMkG,YAAW,GAAIlG,MAAMmG;IAAO;IAAA,SAAA;IAEjDC,eAAe3F,MAAM8E,cAAcvF,KAAK;IAAC,IAAAyB,WAAA;KAAA,OAAA,CAAAP,gBAExCgB,cAAY;MAAQlC;MAAK,IAAEiC,WAAQ;OAAA,OAAExB,MAAM6E,eAAetF,MAAMgG;MAAE;KAAA,CAAA,UAAA;MAAA,IAAAK,SAAAC,QAAA,GAAAC,SAAAF,OAAA9D;MAAAtB,OAAAsF,cAE9BvG,MAAMmG,KAAK;MAAAlF,OAAAoF,QAAAnF,gBAC7CxB,MAAI;OAAA,IAAC8G,OAAI;QAAA,OAAExG,MAAMyG,WAAW;OAAM;OAAA,IAAAhF,WAAA;QAAA,IAAAiF,SAAAC,QAAA;QAAA1F,OAAAyF,cACa1G,MAAMkG,WAAW;QAAA,OAAAQ;OAAA;MAAA,CAAA,GAAA,IAAA;MAAA,OAAAL;KAAA,EAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAItE,CAAA,CAAA;EAAA,OAAAZ;CAAA,EAAA,CAAA;AAIT"}
|
|
1
|
+
{"version":3,"file":"theme-picker.js","names":["ComponentProps","For","Show","splitProps","cn","ThemeVariant","Button","ThemeSwatchProps","theme","size","swatchSizes","sm","md","lg","const","ThemeSwatch","props","local","rest","colors","_el$","_tmpl$","_$spread","_$mergeProps","class","_$insert","_$createComponent","each","background","card","primary","accent","destructiveAction","children","color","_el$2","_tmpl$2","_$setStyleProperty","_$effect","_$className","ThemePreviewProps","selected","ThemePreview","c","_el$3","_tmpl$3","_el$4","firstChild","_el$5","_el$6","_el$7","nextSibling","_el$8","_el$9","_el$0","_el$1","_el$10","_el$11","_el$12","_el$13","_el$14","style","_p$","_v$","sidebar","_v$2","sidebarBorder","_v$3","_v$4","sidebarAccent","_v$5","_v$6","foreground","_v$7","mutedForeground","_v$8","_v$9","_v$0","_v$1","secondary","e","t","a","o","i","n","s","h","r","d","l","undefined","ThemePickerProps","themes","selectedId","onThemeSelect","ThemePicker","_el$15","_tmpl$4","as","type","variant","role","aria-checked","id","aria-label","familyLabel","label","onClick","_el$16","_tmpl$6","_el$17","when","family","_el$18","_tmpl$5","_$mergeProps","_$createComponent","_$className","_$setStyleProperty"],"sources":["../../../src/components/theme/theme-picker.tsx"],"sourcesContent":["import type { ComponentProps } from 'solid-js'\nimport { For, Show, splitProps } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport type { ThemeVariant } from '#lib/themes'\nimport { Button } from '../ui/button/button'\n\n/**\n * ThemeSwatch.\n *\n * The colours of a theme, as a small readable strip: the canvas, a card, the\n * primary, an accent and the destructive fill. Enough to tell two dark themes\n * apart at a glance and to recognise the one you want without applying it.\n *\n * A swatch is **read from the variant object**, not from a stylesheet, so a picker\n * can show a theme that is not currently applied — which is the whole point of a\n * picker. That is also why the catalogue is data rather than CSS.\n */\nexport type ThemeSwatchProps = ComponentProps<'span'> & {\n theme: ThemeVariant\n /** Draw the swatch at the given size. */\n size?: 'sm' | 'md' | 'lg'\n}\n\nconst swatchSizes = {\n sm: 'h-4 w-4',\n md: 'h-6 w-6',\n lg: 'h-8 w-8',\n} as const\n\nexport function ThemeSwatch(props: ThemeSwatchProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'size'])\n const colors = () => local.theme.colors\n\n return (\n <span\n data-slot=\"theme-swatch\"\n aria-hidden=\"true\"\n class={cn(\n 'border-border inline-flex shrink-0 overflow-hidden rounded-md border',\n local.class\n )}\n {...rest}\n >\n <For\n each={[\n colors().background,\n colors().card,\n colors().primary,\n colors().accent,\n colors().destructiveAction,\n ]}\n >\n {(color) => (\n <span\n class={cn('block', swatchSizes[local.size ?? 'md'])}\n style={{ 'background-color': color }}\n />\n )}\n </For>\n </span>\n )\n}\n\n/**\n * ThemePreview.\n *\n * A miniature of the interface, painted in a theme's own colours: a rail, a panel,\n * a heading, body text, a primary button and a destructive one.\n *\n * The point is that a colour strip cannot answer the question a user actually has —\n * \"would I want to look at this all day?\" — and a real preview can. It is drawn\n * with inline colours from the variant rather than by applying the theme, so a list\n * of twenty previews costs one object read each instead of twenty theme swaps.\n */\nexport type ThemePreviewProps = ComponentProps<'div'> & {\n theme: ThemeVariant\n /** Highlight the preview as the current selection. */\n selected?: boolean\n}\n\nexport function ThemePreview(props: ThemePreviewProps) {\n const [local, rest] = splitProps(props, ['class', 'theme', 'selected'])\n const c = () => local.theme.colors\n\n return (\n <div\n data-slot=\"theme-preview\"\n class={cn(\n 'w-44 overflow-hidden rounded-lg border shadow-xs',\n local.selected ? 'border-primary ring-3 ring-primary-subtle' : 'border-border',\n local.class\n )}\n style={{ 'background-color': c().background }}\n {...rest}\n >\n <div class=\"flex h-24\">\n {/* A rail and a panel: the two surfaces a user spends the day looking at. */}\n <div\n class=\"theme-preview-edge flex w-6 flex-col items-center gap-1.5 border-e py-2\"\n style={{ 'background-color': c().sidebar, '--preview-edge': c().sidebarBorder }}\n >\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n <span class=\"size-2.5 rounded-sm\" style={{ 'background-color': c().sidebarAccent }} />\n </div>\n <div class=\"flex flex-1 flex-col gap-1.5 p-2\">\n <div class=\"h-1.5 w-14 rounded-full\" style={{ 'background-color': c().foreground }} />\n <div class=\"h-1 w-20 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"h-1 w-16 rounded-full\" style={{ 'background-color': c().mutedForeground }} />\n <div class=\"mt-auto flex items-center gap-1\">\n <span class=\"h-3 w-9 rounded-sm\" style={{ 'background-color': c().primary }} />\n <span\n class=\"h-3 w-6 rounded-sm\"\n style={{ 'background-color': c().destructiveAction }}\n />\n <span class=\"h-3 w-6 rounded-sm\" style={{ 'background-color': c().secondary }} />\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * ThemePicker.\n *\n * The catalogue as a selectable grid. One appearance at a time — a light picker\n * lists light themes and a dark picker lists dark ones — because choosing a dark\n * theme while looking at a light interface is a choice nobody can evaluate.\n *\n * `onSelect` rather than an internal signal: the selection belongs to the\n * preference the provider owns, and a picker that kept its own copy could disagree\n * with what is applied.\n */\nexport type ThemePickerProps = ComponentProps<'div'> & {\n themes: readonly ThemeVariant[]\n selectedId: string\n onThemeSelect: (theme: ThemeVariant) => void\n}\n\nexport function ThemePicker(props: ThemePickerProps) {\n const [local, rest] = splitProps(props, ['class', 'themes', 'selectedId', 'onThemeSelect'])\n\n return (\n <div\n data-slot=\"theme-picker\"\n role=\"radiogroup\"\n aria-label=\"Theme\"\n class={cn('flex flex-wrap gap-3', local.class)}\n {...rest}\n >\n <For each={local.themes}>\n {(theme) => (\n <Button\n as=\"button\"\n type=\"button\"\n variant=\"ghost\"\n size=\"sm\"\n role=\"radio\"\n aria-checked={local.selectedId === theme.id}\n aria-label={`${theme.familyLabel} ${theme.label}`}\n class=\"h-auto flex-col gap-1.5 p-0 hover:bg-transparent\"\n onClick={() => local.onThemeSelect(theme)}\n >\n <ThemePreview theme={theme} selected={local.selectedId === theme.id} />\n <span class=\"flex flex-col items-center\">\n <span class=\"text-xs font-medium\">{theme.label}</span>\n <Show when={theme.family !== 'adea'}>\n <span class=\"text-muted-foreground text-2xs\">{theme.familyLabel}</span>\n </Show>\n </span>\n </Button>\n )}\n </For>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAMU,cAAc;CAClBC,IAAI;CACJC,IAAI;CACJC,IAAI;AACN;AAEA,SAAgBE,YAAYC,OAAyB;CACnD,MAAM,CAACC,OAAOC,QAAQf,WAAWa,OAAO;EAAC;EAAS;EAAS;CAAM,CAAC;CAClE,MAAMG,eAAeF,MAAMT,MAAMW;CAEjC,cAAA;EAAA,IAAAC,OAAAC,OAAA;EAAAC,OAAAF,MAAAG,WAAA,EAAA,KAAA,WAAA;GAAA,OAIWnB,GACL,wEACAa,MAAMO,KACR;EAAC,EAAA,GACGN,IAAI,GAAA,OAAA,IAAA;EAAAO,OAAAL,MAAAM,gBAEP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MyG,WAAW;OAAM;OAAA,IAAAhF,WAAA;QAAA,IAAAiF,SAAAC,QAAA;QAAA1F,OAAAyF,cACa1G,MAAMkG,WAAW;QAAA,OAAAQ;OAAA;MAAA,CAAA,GAAA,IAAA;MAAA,OAAAL;KAAA,EAAA,CAAA,CAAA;IAAA;GAAA,CAAA;EAItE,CAAA,CAAA;EAAA,OAAAZ;CAAA,EAAA,CAAA;AAIT"}
|
|
@@ -27,7 +27,7 @@ var buttonVariants = cva(`${controlInteractive} inline-flex shrink-0 items-cente
|
|
|
27
27
|
default: "bg-primary text-primary-foreground hover:bg-primary-hover",
|
|
28
28
|
secondary: "bg-secondary text-secondary-foreground hover:bg-surface-hover",
|
|
29
29
|
/** For the action that destroys something. Never the default. */
|
|
30
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive-subtle",
|
|
30
|
+
destructive: "bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle",
|
|
31
31
|
/** A bordered button for a surface that already has a fill. */
|
|
32
32
|
outline: "border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input",
|
|
33
33
|
/** No chrome until hover. The default for toolbar and row actions. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","names":["Polymorphic","PolymorphicProps","ComponentProps","splitProps","ValidComponent","cva","controlInteractive","controlSize","VariantProps","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","subtle","success","link","size","xs","sm","md","lg","xl","defaultVariants","ButtonVariantProps","ButtonProps","T","class","Button","props","local","rest","_$createComponent","_$mergeProps","as","type","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps, ['variant', 'size', 'class'])\n\n return (\n <Polymorphic\n as=\"button\"\n type=\"button\"\n class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}\n {...(rest as ComponentProps<'button'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaU,iBAAiBL,IAC5B,GAAGC,mBAAkB,sJACrB;CACEK,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;GAEPC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GAKrB,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;EACb;CACF;CACAC,iBAAiB;EACff,SAAS;EACTS,MAAM;CACR;AACF,CACF;AAWA,SAAgBW,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQhC,WAAW8B,OAAsB;EAAC;EAAW;EAAQ;CAAO,CAAC;CAEnF,OAAAG,gBACGpC,aAAWqC,WAAA;EACVC,IAAE;EACFC,MAAI;EAAA,KAAA,WAAA;GAAA,OACG9B,GAAGC,eAAe;IAAEE,SAASsB,MAAMtB;IAASS,MAAMa,MAAMb;GAAK,CAAC,GAAGa,MAAMH,KAAK;EAAC;CAAA,GAC/EI,IAAgC,CAAA;AAG3C"}
|
|
1
|
+
{"version":3,"file":"button.js","names":["Polymorphic","PolymorphicProps","ComponentProps","splitProps","ValidComponent","cva","controlInteractive","controlSize","VariantProps","cn","buttonVariants","variants","variant","default","secondary","destructive","outline","ghost","subtle","success","link","size","xs","sm","md","lg","xl","defaultVariants","ButtonVariantProps","ButtonProps","T","class","Button","props","local","rest","_$createComponent","_$mergeProps","as","type","_$createComponent","_$mergeProps"],"sources":["../../../../src/components/ui/button/button.tsx"],"sourcesContent":["import { Polymorphic, type PolymorphicProps } from '@kobalte/core/polymorphic'\nimport { type ComponentProps, splitProps, type ValidComponent } from 'solid-js'\nimport { cva, controlInteractive, controlSize, type VariantProps } from '#lib/variants'\nimport { cn } from '#lib/utils'\n\n/**\n * Button.\n *\n * One appearance ladder shared by every pressable thing in the system: a\n * button, a toolbar control, a dialog action, and a menu row all draw from the\n * same tokens, so a row of them cannot drift apart.\n *\n * The variants answer \"what is this for\", never \"what colour is it\". A caller\n * that wants a red button writes `variant=\"destructive\"`; the red lives here.\n * That is also what lets the design-system linter tell a caller which variant\n * to use instead of only which class was wrong.\n *\n * Polymorphic: pass `as=\"a\"` (or any component) and the button becomes it\n * while keeping the same styling contract. This replaces the React-era\n * `asChild` primitive, which has no Solid equivalent that preserves props.\n */\nexport const buttonVariants = cva(\n `${controlInteractive} inline-flex shrink-0 items-center justify-center rounded-md font-medium whitespace-nowrap select-none [&_svg]:pointer-events-none [&_svg]:shrink-0`,\n {\n variants: {\n variant: {\n /** The one primary action in a view. */\n default: 'bg-primary text-primary-foreground hover:bg-primary-hover',\n secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',\n /** For the action that destroys something. Never the default. */\n destructive:\n 'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',\n /** A bordered button for a surface that already has a fill. */\n outline:\n 'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',\n /** No chrome until hover. The default for toolbar and row actions. */\n ghost: 'text-foreground hover:bg-surface-hover',\n /** A tinted primary, for a secondary action inside a primary flow. */\n subtle: 'bg-primary-subtle text-primary hover:bg-primary-subtle/80',\n success: 'bg-success text-success-foreground hover:bg-success/90',\n link: 'text-primary underline-offset-4 hover:underline',\n },\n size: {\n '2xs': `${controlSize['2xs']} [&_svg]:size-3`,\n xs: `${controlSize.xs} [&_svg]:size-3.5`,\n sm: `${controlSize.sm} [&_svg]:size-3.5`,\n md: `${controlSize.md} [&_svg]:size-4`,\n lg: `${controlSize.lg} [&_svg]:size-4`,\n xl: `${controlSize.xl} [&_svg]:size-5`,\n /* Square, for an icon with no label. The accessible name then has to\n come from `aria-label` or a visually hidden label — an icon-only\n button with neither is the accessibility finding the Storybook lane\n catches on every story. */\n 'icon-2xs': 'size-control-2xs p-0 [&_svg]:size-3',\n 'icon-xs': 'size-control-xs p-0 [&_svg]:size-3.5',\n 'icon-sm': 'size-control-sm p-0 [&_svg]:size-3.5',\n 'icon-md': 'size-control-md p-0 [&_svg]:size-4',\n 'icon-lg': 'size-control-lg p-0 [&_svg]:size-4',\n 'icon-xl': 'size-control-xl p-0 [&_svg]:size-5',\n },\n },\n defaultVariants: {\n variant: 'default',\n size: 'md',\n },\n }\n)\n\ntype ButtonVariantProps = VariantProps<typeof buttonVariants>\n\nexport type ButtonProps<T extends ValidComponent = 'button'> = PolymorphicProps<\n T,\n ButtonVariantProps & {\n class?: string\n }\n>\n\nexport function Button<T extends ValidComponent = 'button'>(props: ButtonProps<T>) {\n const [local, rest] = splitProps(props as ButtonProps, ['variant', 'size', 'class'])\n\n return (\n <Polymorphic\n as=\"button\"\n type=\"button\"\n class={cn(buttonVariants({ variant: local.variant, size: local.size }), local.class)}\n {...(rest as ComponentProps<'button'>)}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAaU,iBAAiBL,IAC5B,GAAGC,mBAAkB,sJACrB;CACEK,UAAU;EACRC,SAAS;;GAEPC,SAAS;GACTC,WAAW;;GAEXC,aACE;;GAEFC,SACE;;GAEFC,OAAO;;GAEPC,QAAQ;GACRC,SAAS;GACTC,MAAM;EACR;EACAC,MAAM;GACJ,OAAO,GAAGd,YAAY,OAAM;GAC5Be,IAAI,GAAGf,YAAYe,GAAE;GACrBC,IAAI,GAAGhB,YAAYgB,GAAE;GACrBC,IAAI,GAAGjB,YAAYiB,GAAE;GACrBC,IAAI,GAAGlB,YAAYkB,GAAE;GACrBC,IAAI,GAAGnB,YAAYmB,GAAE;GAKrB,YAAY;GACZ,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;GACX,WAAW;EACb;CACF;CACAC,iBAAiB;EACff,SAAS;EACTS,MAAM;CACR;AACF,CACF;AAWA,SAAgBW,OAA4CC,OAAuB;CACjF,MAAM,CAACC,OAAOC,QAAQhC,WAAW8B,OAAsB;EAAC;EAAW;EAAQ;CAAO,CAAC;CAEnF,OAAAG,gBACGpC,aAAWqC,WAAA;EACVC,IAAE;EACFC,MAAI;EAAA,KAAA,WAAA;GAAA,OACG9B,GAAGC,eAAe;IAAEE,SAASsB,MAAMtB;IAASS,MAAMa,MAAMb;GAAK,CAAC,GAAGa,MAAMH,KAAK;EAAC;CAAA,GAC/EI,IAAgC,CAAA;AAG3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/dialog/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAE9D,OAAO,KAAK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,CAAC,KAAK,EAAE,kBAAkB,eAiCtD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,eASxD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,eASxD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,KAAK,CAAC,eAQ5E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,eAKxF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,eAGxF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,WAAW,CAAC,eAGlF"}
|
|
@@ -164,7 +164,7 @@ function DialogContent(props) {
|
|
|
164
164
|
var _el$ = _tmpl$();
|
|
165
165
|
className(_el$, overlayPositioner);
|
|
166
166
|
insert(_el$, createComponent(Dialog.Content, mergeProps({ get ["class"]() {
|
|
167
|
-
return cn(overlaySurface, overlayMotion, "grid w-full max-w-lg gap-4 p-5", local.class);
|
|
167
|
+
return cn(overlaySurface, overlayMotion, "relative grid w-full max-w-lg gap-4 p-5", local.class);
|
|
168
168
|
} }, rest, { get children() {
|
|
169
169
|
return [memo(() => local.children), createComponent(Show, {
|
|
170
170
|
get when() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","names":["Dialog","KobalteDialog","X","Accessor","ComponentProps","JSX","createRenderEffect","onCleanup","Show","splitProps","overlayMotion","overlayPositioner","overlayScrim","overlaySurface","cn","FocusCycle","content","HTMLElement","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","frame","fallbackTimer","observer","MutationObserver","onFocusIn","event","FocusEvent","canRestoreFocus","target","isConnected","document","body","documentElement","closest","matches","getClientRects","length","hasOtherOverlay","querySelectorAll","some","overlay","contains","DialogFocusRestorationOptions","open","restoreFocusRef","onOpenAutoFocus","Content","onCloseAutoFocus","createDialogFocusRestoration","callerOnOpenAutoFocus","callerOnCloseAutoFocus","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","Event","element","currentTarget","openerWasCaptured","focusEvent","set","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","queueMicrotask","setTimeout","props","_$createComponent","DialogTrigger","Trigger","DialogPortal","Portal","DialogOverlay","Overlay","local","rest","_$mergeProps","class","DialogContentProps","closeButton","Element","DialogContent","children","_el$","_tmpl$","_$className","_$insert","_$memo","when","CloseButton","DialogHeader","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogCloseButton","DialogClose","Dialog","_$createComponent","KobalteDialog","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import { Dialog as KobalteDialog } from '@kobalte/core/dialog'\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup, Show, splitProps } from 'solid-js'\nimport { overlayMotion, overlayPositioner, overlayScrim, overlaySurface } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target.isConnected &&\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n target.getClientRects().length > 0\n )\n}\n\nfunction hasOtherOverlay(content: HTMLElement, opener: HTMLElement): boolean {\n return [...document.querySelectorAll<HTMLElement>('[role=\"dialog\"], [role=\"alertdialog\"]')].some(\n (overlay) =>\n overlay !== content &&\n !content.contains(overlay) &&\n !overlay.contains(opener) &&\n !overlay.closest('[aria-hidden=\"true\"], [inert]') &&\n overlay.getClientRects().length > 0\n )\n}\n\ntype DialogFocusRestorationOptions = {\n open: Accessor<boolean>\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: ComponentProps<typeof KobalteDialog.Content>['onOpenAutoFocus']\n onCloseAutoFocus?: ComponentProps<typeof KobalteDialog.Content>['onCloseAutoFocus']\n}\n\n/**\n * Adds guarded opener capture and restoration to a Kobalte dialog content.\n * Composed surfaces use this internal helper; it is omitted from the public\n * dialog barrel so the restoration policy stays with the dialog components.\n */\nexport function createDialogFocusRestoration({\n open,\n restoreFocusRef,\n onOpenAutoFocus: callerOnOpenAutoFocus,\n onCloseAutoFocus: callerOnCloseAutoFocus,\n}: DialogFocusRestorationOptions) {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !opener.isConnected ||\n opener.matches(':disabled') ||\n opener.getClientRects().length === 0 ||\n !focusIsAvailable ||\n hasOtherOverlay(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Inert and aria-hidden are removed by the dialog's containment cleanup.\n // Wait for that cleanup before returning focus to the original control.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) return\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const cycle: FocusCycle = {\n content: element,\n opener: opener instanceof HTMLElement ? opener : null,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement ||\n target === element ||\n element.contains(target) ||\n target === (opener instanceof HTMLElement ? opener : null)\n ) {\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n callerOnOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n callerOnCloseAutoFocus?.(event)\n\n if (!cycle) return\n cycle.closed = true\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n cycle.closed = true\n\n // Kobalte dispatches unmount autofocus from a timer. This fallback only\n // releases the scoped focus listener if the content did not dispatch it.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key,\n * scroll locking and returning focus to the trigger on close.\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport function Dialog(props: ComponentProps<typeof KobalteDialog>) {\n return <KobalteDialog {...props} />\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof KobalteDialog.Trigger>) {\n return <KobalteDialog.Trigger {...props} />\n}\n\nexport function DialogPortal(props: ComponentProps<typeof KobalteDialog.Portal>) {\n return <KobalteDialog.Portal {...props} />\n}\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialog.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialog.Overlay\n class={cn(\n overlayScrim,\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialog.Content> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n}\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, ['class', 'children', 'closeButton'])\n\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={overlayPositioner}>\n <KobalteDialog.Content\n class={cn(overlaySurface, overlayMotion, 'grid w-full max-w-lg gap-4 p-5', local.class)}\n {...rest}\n >\n {local.children}\n <Show when={local.closeButton !== false}>\n <KobalteDialog.CloseButton\n aria-label=\"Close\"\n class={cn(\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground',\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n )}\n >\n {local.closeButton ?? <X class=\"size-4\" />}\n </KobalteDialog.CloseButton>\n </Show>\n </KobalteDialog.Content>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\nexport function DialogHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn('flex flex-col gap-1.5 pe-6 text-start', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"dialog-footer\"\n class={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialog.Title\n class={cn('text-base leading-none font-semibold tracking-tight', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialog.Description class={cn('text-muted-foreground text-sm', local.class)} {...rest} />\n )\n}\n\nexport function DialogCloseButton(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/**\n * The close control, unstyled and polymorphic — for a footer's text \"Cancel\" or\n * \"Close\", which is a different control from the corner icon `DialogCloseButton`\n * draws. Take it as `as={Button}` so it carries the button's variants rather than\n * a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAS8B,gBAAgBC,QAA8B;CACrD,OACEA,OAAOC,eACPD,WAAWE,SAASC,QACpBH,WAAWE,SAASE,mBACpB,CAACJ,OAAOK,QAAQ,iCAA+B,KAC/C,CAACL,OAAOM,QAAQ,WAAW,KAC3BN,OAAOO,eAAe,CAAC,CAACC,SAAS;AAErC;AAEA,SAASC,gBAAgBxB,SAAsBE,QAA8B;CAC3E,OAAO,CAAC,GAAGe,SAASQ,iBAA8B,2CAAuC,CAAC,CAAC,CAACC,MACzFC,YACCA,YAAY3B,WACZ,CAACA,QAAQ4B,SAASD,OAAO,KACzB,CAACA,QAAQC,SAAS1B,MAAM,KACxB,CAACyB,QAAQP,QAAQ,iCAA+B,KAChDO,QAAQL,eAAe,CAAC,CAACC,SAAS,CACtC;AACF;;;;;;AAcA,SAAgBY,6BAA6B,EAC3CL,MACAC,iBACAC,iBAAiBI,uBACjBF,kBAAkBG,0BACc;CAChC,MAAMC,8BAAc,IAAIC,QAAiC;CACzD,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A,EAAA,KAAA,WAAA;EAAA,OAAQvF,GAAG,cAAcqF,MAAMG,KAAK;CAAC,EAAA,GAAMF,IAAI,CAAA;AAClF"}
|
|
1
|
+
{"version":3,"file":"dialog.js","names":["Dialog","KobalteDialog","X","Accessor","ComponentProps","JSX","createRenderEffect","onCleanup","Show","splitProps","overlayMotion","overlayPositioner","overlayScrim","overlaySurface","cn","FocusCycle","content","HTMLElement","opener","openerEligible","closed","focusMovedOutside","closeAutoFocusScheduled","frame","fallbackTimer","observer","MutationObserver","onFocusIn","event","FocusEvent","canRestoreFocus","target","isConnected","document","body","documentElement","closest","matches","getClientRects","length","hasOtherOverlay","querySelectorAll","some","overlay","contains","DialogFocusRestorationOptions","open","restoreFocusRef","onOpenAutoFocus","Content","onCloseAutoFocus","createDialogFocusRestoration","callerOnOpenAutoFocus","callerOnCloseAutoFocus","focusCycles","WeakMap","activeFocusCycle","pendingOpener","pendingOpenerEligible","active","activeElement","finishFocusCycle","cycle","undefined","window","cancelAnimationFrame","clearTimeout","disconnect","removeEventListener","scheduleFocusRestore","requestAnimationFrame","focusIsAvailable","Node","focus","preventScroll","Event","element","currentTarget","openerWasCaptured","focusEvent","set","addEventListener","get","defaultPrevented","observe","attributes","attributeFilter","childList","subtree","queueMicrotask","setTimeout","props","_$createComponent","DialogTrigger","Trigger","DialogPortal","Portal","DialogOverlay","Overlay","local","rest","_$mergeProps","class","DialogContentProps","closeButton","Element","DialogContent","children","_el$","_tmpl$","_$className","_$insert","_$memo","when","CloseButton","DialogHeader","_el$2","_tmpl$2","_$spread","DialogFooter","_el$3","_tmpl$3","DialogTitle","Title","DialogDescription","Description","DialogCloseButton","DialogClose","Dialog","_$createComponent","KobalteDialog","_$mergeProps","_$memo"],"sources":["../../../../src/components/ui/dialog/dialog.tsx"],"sourcesContent":["import { Dialog as KobalteDialog } from '@kobalte/core/dialog'\nimport { X } from 'lucide-solid'\nimport type { Accessor, ComponentProps, JSX } from 'solid-js'\nimport { createRenderEffect, onCleanup, Show, splitProps } from 'solid-js'\nimport { overlayMotion, overlayPositioner, overlayScrim, overlaySurface } from '#lib/overlay'\nimport { cn } from '#lib/utils'\n\ntype FocusCycle = {\n content: HTMLElement\n opener: HTMLElement | null\n openerEligible: boolean\n closed: boolean\n focusMovedOutside: boolean\n closeAutoFocusScheduled: boolean\n frame?: number\n fallbackTimer?: number\n observer?: MutationObserver\n onFocusIn: (event: FocusEvent) => void\n}\n\nfunction canRestoreFocus(target: HTMLElement): boolean {\n return (\n target.isConnected &&\n target !== document.body &&\n target !== document.documentElement &&\n !target.closest('[inert], [aria-hidden=\"true\"]') &&\n !target.matches(':disabled') &&\n target.getClientRects().length > 0\n )\n}\n\nfunction hasOtherOverlay(content: HTMLElement, opener: HTMLElement): boolean {\n return [...document.querySelectorAll<HTMLElement>('[role=\"dialog\"], [role=\"alertdialog\"]')].some(\n (overlay) =>\n overlay !== content &&\n !content.contains(overlay) &&\n !overlay.contains(opener) &&\n !overlay.closest('[aria-hidden=\"true\"], [inert]') &&\n overlay.getClientRects().length > 0\n )\n}\n\ntype DialogFocusRestorationOptions = {\n open: Accessor<boolean>\n restoreFocusRef?: Accessor<HTMLElement | undefined>\n onOpenAutoFocus?: ComponentProps<typeof KobalteDialog.Content>['onOpenAutoFocus']\n onCloseAutoFocus?: ComponentProps<typeof KobalteDialog.Content>['onCloseAutoFocus']\n}\n\n/**\n * Adds guarded opener capture and restoration to a Kobalte dialog content.\n * Composed surfaces use this internal helper; it is omitted from the public\n * dialog barrel so the restoration policy stays with the dialog components.\n */\nexport function createDialogFocusRestoration({\n open,\n restoreFocusRef,\n onOpenAutoFocus: callerOnOpenAutoFocus,\n onCloseAutoFocus: callerOnCloseAutoFocus,\n}: DialogFocusRestorationOptions) {\n const focusCycles = new WeakMap<HTMLElement, FocusCycle>()\n let activeFocusCycle: FocusCycle | undefined\n let pendingOpener: HTMLElement | null = null\n let pendingOpenerEligible = false\n\n createRenderEffect(() => {\n if (!open() || typeof document === 'undefined') {\n pendingOpener = null\n pendingOpenerEligible = false\n return\n }\n const active = restoreFocusRef?.() ?? document.activeElement\n pendingOpener = active instanceof HTMLElement ? active : null\n pendingOpenerEligible = active instanceof HTMLElement && canRestoreFocus(active)\n })\n\n const finishFocusCycle = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) window.cancelAnimationFrame(cycle.frame)\n if (cycle.fallbackTimer !== undefined) window.clearTimeout(cycle.fallbackTimer)\n cycle.observer?.disconnect()\n document.removeEventListener('focusin', cycle.onFocusIn)\n if (activeFocusCycle === cycle) activeFocusCycle = undefined\n }\n\n const scheduleFocusRestore = (cycle: FocusCycle) => {\n if (cycle.frame !== undefined) return\n cycle.frame = window.requestAnimationFrame(() => {\n cycle.frame = undefined\n const opener = cycle.opener\n const active = document.activeElement\n const focusIsAvailable =\n active === document.body ||\n active === document.documentElement ||\n active === cycle.content ||\n (active instanceof Node && cycle.content.contains(active))\n if (\n activeFocusCycle !== cycle ||\n !cycle.closed ||\n cycle.focusMovedOutside ||\n !opener ||\n !opener.isConnected ||\n opener.matches(':disabled') ||\n opener.getClientRects().length === 0 ||\n !focusIsAvailable ||\n hasOtherOverlay(cycle.content, opener)\n ) {\n finishFocusCycle(cycle)\n return\n }\n\n // Inert and aria-hidden are removed by the dialog's containment cleanup.\n // Wait for that cleanup before returning focus to the original control.\n if (opener.closest('[inert], [aria-hidden=\"true\"]')) return\n if (cycle.openerEligible && canRestoreFocus(opener)) {\n opener.focus({ preventScroll: true })\n }\n finishFocusCycle(cycle)\n })\n }\n\n const onOpenAutoFocus = (event: Event) => {\n const element = event.currentTarget\n if (element instanceof HTMLElement) {\n if (activeFocusCycle) finishFocusCycle(activeFocusCycle)\n\n const openerWasCaptured = pendingOpener !== null\n const opener = pendingOpener ?? document.activeElement\n const openerEligible = openerWasCaptured\n ? pendingOpenerEligible\n : opener instanceof HTMLElement && canRestoreFocus(opener)\n pendingOpener = null\n pendingOpenerEligible = false\n const cycle: FocusCycle = {\n content: element,\n opener: opener instanceof HTMLElement ? opener : null,\n openerEligible,\n closed: false,\n focusMovedOutside: false,\n closeAutoFocusScheduled: false,\n onFocusIn: (focusEvent) => {\n const target = focusEvent.target\n if (\n !(target instanceof HTMLElement) ||\n target === document.body ||\n target === document.documentElement ||\n target === element ||\n element.contains(target) ||\n target === (opener instanceof HTMLElement ? opener : null)\n ) {\n return\n }\n cycle.focusMovedOutside = true\n },\n }\n focusCycles.set(element, cycle)\n activeFocusCycle = cycle\n document.addEventListener('focusin', cycle.onFocusIn)\n }\n callerOnOpenAutoFocus?.(event)\n }\n\n const onCloseAutoFocus = (event: Event) => {\n const element = event.currentTarget\n const cycle = element instanceof HTMLElement ? focusCycles.get(element) : undefined\n callerOnCloseAutoFocus?.(event)\n\n if (!cycle) return\n cycle.closed = true\n\n // A caller that prevents Kobalte's close autofocus owns the focus decision.\n if (event.defaultPrevented) {\n finishFocusCycle(cycle)\n return\n }\n\n if (cycle.fallbackTimer !== undefined) {\n window.clearTimeout(cycle.fallbackTimer)\n cycle.fallbackTimer = undefined\n }\n cycle.closeAutoFocusScheduled = true\n cycle.observer = new MutationObserver(() => scheduleFocusRestore(cycle))\n cycle.observer.observe(document.body, {\n attributes: true,\n attributeFilter: ['aria-hidden', 'inert'],\n childList: true,\n subtree: true,\n })\n scheduleFocusRestore(cycle)\n }\n\n onCleanup(() => {\n const cycle = activeFocusCycle\n if (!cycle) return\n cycle.closed = true\n\n // Kobalte dispatches unmount autofocus from a timer. This fallback only\n // releases the scoped focus listener if the content did not dispatch it.\n queueMicrotask(() => {\n if (cycle.closeAutoFocusScheduled) return\n cycle.fallbackTimer = window.setTimeout(() => {\n cycle.fallbackTimer = undefined\n if (!cycle.closeAutoFocusScheduled) finishFocusCycle(cycle)\n }, 0)\n })\n })\n\n return { onOpenAutoFocus, onCloseAutoFocus }\n}\n\n/**\n * Dialog.\n *\n * A modal surface for a decision or a short task. `Dialog.Portal` keeps the\n * panel out of the app's stacking and overflow contexts, `Dialog.Overlay`\n * dims what is behind it, and Kobalte handles the focus trap, the escape key,\n * scroll locking and returning focus to the trigger on close.\n *\n * The close button is part of the content rather than optional, because every\n * modal needs a way out that is not the keyboard. A dialog whose only exit is\n * Escape is a trap for anyone using a pointer.\n */\nexport function Dialog(props: ComponentProps<typeof KobalteDialog>) {\n return <KobalteDialog {...props} />\n}\n\nexport function DialogTrigger(props: ComponentProps<typeof KobalteDialog.Trigger>) {\n return <KobalteDialog.Trigger {...props} />\n}\n\nexport function DialogPortal(props: ComponentProps<typeof KobalteDialog.Portal>) {\n return <KobalteDialog.Portal {...props} />\n}\n\nexport function DialogOverlay(props: ComponentProps<typeof KobalteDialog.Overlay>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialog.Overlay\n class={cn(\n overlayScrim,\n 'data-expanded:animate-in data-expanded:fade-in-0 data-closed:animate-out data-closed:fade-out-0',\n local.class\n )}\n {...rest}\n />\n )\n}\n\nexport type DialogContentProps = ComponentProps<typeof KobalteDialog.Content> & {\n /**\n * Replaces the default close button. Pass `false` to remove it — only for a\n * dialog that cannot be dismissed (an update that must finish); anything the\n * user can escape from needs the button.\n */\n closeButton?: JSX.Element | false\n}\n\nexport function DialogContent(props: DialogContentProps) {\n const [local, rest] = splitProps(props, ['class', 'children', 'closeButton'])\n\n return (\n <KobalteDialog.Portal>\n <DialogOverlay />\n <div class={overlayPositioner}>\n <KobalteDialog.Content\n class={cn(\n overlaySurface,\n overlayMotion,\n 'relative grid w-full max-w-lg gap-4 p-5',\n local.class\n )}\n {...rest}\n >\n {local.children}\n <Show when={local.closeButton !== false}>\n <KobalteDialog.CloseButton\n aria-label=\"Close\"\n class={cn(\n 'absolute top-3.5 end-3.5 rounded-md p-1 text-muted-foreground',\n 'transition-colors ease-out hover:bg-surface-hover hover:text-foreground',\n 'focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-primary-subtle outline-none'\n )}\n >\n {local.closeButton ?? <X class=\"size-4\" />}\n </KobalteDialog.CloseButton>\n </Show>\n </KobalteDialog.Content>\n </div>\n </KobalteDialog.Portal>\n )\n}\n\nexport function DialogHeader(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"dialog-header\"\n class={cn('flex flex-col gap-1.5 pe-6 text-start', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogFooter(props: ComponentProps<'div'>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <div\n data-slot=\"dialog-footer\"\n class={cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogTitle(props: ComponentProps<typeof KobalteDialog.Title>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialog.Title\n class={cn('text-base leading-none font-semibold tracking-tight', local.class)}\n {...rest}\n />\n )\n}\n\nexport function DialogDescription(props: ComponentProps<typeof KobalteDialog.Description>) {\n const [local, rest] = splitProps(props, ['class'])\n return (\n <KobalteDialog.Description class={cn('text-muted-foreground text-sm', local.class)} {...rest} />\n )\n}\n\nexport function DialogCloseButton(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n\n/**\n * The close control, unstyled and polymorphic — for a footer's text \"Cancel\" or\n * \"Close\", which is a different control from the corner icon `DialogCloseButton`\n * draws. Take it as `as={Button}` so it carries the button's variants rather than\n * a copied class string.\n */\nexport function DialogClose(props: ComponentProps<typeof KobalteDialog.CloseButton>) {\n const [local, rest] = splitProps(props, ['class'])\n return <KobalteDialog.CloseButton class={cn('focus-ring', local.class)} {...rest} />\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAS8B,gBAAgBC,QAA8B;CACrD,OACEA,OAAOC,eACPD,WAAWE,SAASC,QACpBH,WAAWE,SAASE,mBACpB,CAACJ,OAAOK,QAAQ,iCAA+B,KAC/C,CAACL,OAAOM,QAAQ,WAAW,KAC3BN,OAAOO,eAAe,CAAC,CAACC,S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,CAAA;AAEhG;AAEA,SAAgB0B,kBAAkBnC,OAAyD;CACzF,MAAM,CAACQ,OAAOC,QAAQ3F,WAAWkF,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAC,gBAAQ3F,OAAciH,aAAWb,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQvF,GAAG,cAAcqF,MAAMG,KAAK;CAAC,EAAA,GAAMF,IAAI,CAAA;AAClF;;;;;;;AAQA,SAAgB2B,YAAYpC,OAAyD;CACnF,MAAM,CAACQ,OAAOC,QAAQ3F,WAAWkF,OAAO,CAAC,OAAO,CAAC;CACjD,OAAAC,gBAAQ3F,OAAciH,aAAWb,WAAA,EAAA,KAAA,WAAA;EAAA,OAAQvF,GAAG,cAAcqF,MAAMG,KAAK;CAAC,EAAA,GAAMF,IAAI,CAAA;AAClF"}
|
package/dist/lib/themes.d.ts
CHANGED
|
@@ -58,6 +58,9 @@ export type ThemeColors = {
|
|
|
58
58
|
destructive: string;
|
|
59
59
|
destructiveForeground: string;
|
|
60
60
|
destructiveSubtle: string;
|
|
61
|
+
/** Contrast-safe solid-action presentation, derived from the canonical error role. */
|
|
62
|
+
destructiveAction: string;
|
|
63
|
+
destructiveActionForeground: string;
|
|
61
64
|
success: string;
|
|
62
65
|
successForeground: string;
|
|
63
66
|
successSubtle: string;
|
package/dist/lib/themes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/lib/themes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;
|
|
1
|
+
{"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../../src/lib/themes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAqBH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,CAAA;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB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ACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAMD,+FAA+F;AAC/F,wBAAgB,aAAa,CAAC,KAAK,EAAE,YAAY,GAAG,YAAY,EAAE,CAMjE;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CACnC,MAAM,GAAE,SAAS,YAAY,EAAkB,GAC9C,YAAY,EAAE,CAchB;AAED,eAAO,MAAM,mBAAmB,eAAe,CAAA;AAC/C,eAAO,MAAM,kBAAkB,cAAc,CAAA;AAE7C,kFAAkF;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/lib/themes.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { accentRoles, chartSeries, contrastRatio, getAccent, hasTheme, primaryHover, primarySubtleCss, statusForeground, syntaxRoles, themes, themesByAppearance, tint, validateCatalogue } from "@adea-ai/themes";
|
|
1
|
+
import { accentRoles, chartSeries, contrastRatio, getAccent, hasTheme, primaryHover, primarySubtleCss, shadcnDestructiveProjection, statusForeground, syntaxRoles, themes, themesByAppearance, tint, validateCatalogue } from "@adea-ai/themes";
|
|
2
2
|
//#region src/lib/themes.ts
|
|
3
3
|
/**
|
|
4
4
|
* The theme registry, now a bridge.
|
|
@@ -34,12 +34,6 @@ import { accentRoles, chartSeries, contrastRatio, getAccent, hasTheme, primaryHo
|
|
|
34
34
|
* `--primary`, and `--accent` is filled from `surfaceHover`, which is what shadcn
|
|
35
35
|
* components actually use it for.
|
|
36
36
|
*/
|
|
37
|
-
/**
|
|
38
|
-
* Canonical role → this system's `ThemeColors` key.
|
|
39
|
-
*
|
|
40
|
-
* Read by {@link toVariant}. Every key of `ThemeColors` must appear, so a role added
|
|
41
|
-
* to this system fails the type check rather than silently resolving to `undefined`.
|
|
42
|
-
*/
|
|
43
37
|
var ROLE_FOR = {
|
|
44
38
|
background: "background",
|
|
45
39
|
foreground: "text",
|
|
@@ -81,6 +75,9 @@ function toVariant(theme) {
|
|
|
81
75
|
for (const key of Object.keys(ROLE_FOR)) colors[key] = theme.colors[ROLE_FOR[key]];
|
|
82
76
|
colors.destructiveForeground = statusForeground(theme, "error");
|
|
83
77
|
colors.destructiveSubtle = tint(theme.colors.error, theme.colors.background);
|
|
78
|
+
const destructiveAction = shadcnDestructiveProjection(theme);
|
|
79
|
+
colors.destructiveAction = destructiveAction.fill;
|
|
80
|
+
colors.destructiveActionForeground = destructiveAction.foreground;
|
|
84
81
|
colors.successForeground = statusForeground(theme, "success");
|
|
85
82
|
colors.successSubtle = tint(theme.colors.success, theme.colors.background);
|
|
86
83
|
colors.warningForeground = statusForeground(theme, "warning");
|
|
@@ -222,6 +219,8 @@ function themeCssVariables(theme) {
|
|
|
222
219
|
"--destructive": c.destructive,
|
|
223
220
|
"--destructive-foreground": c.destructiveForeground,
|
|
224
221
|
"--destructive-subtle": c.destructiveSubtle,
|
|
222
|
+
"--destructive-action": c.destructiveAction,
|
|
223
|
+
"--destructive-action-foreground": c.destructiveActionForeground,
|
|
225
224
|
"--success": c.success,
|
|
226
225
|
"--success-foreground": c.successForeground,
|
|
227
226
|
"--success-subtle": c.successSubtle,
|
package/dist/lib/themes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themes.js","names":["catalogue","themes"],"sources":["../../src/lib/themes.ts"],"sourcesContent":["/**\n * The theme registry, now a bridge.\n *\n * The catalogue itself lives in `@adea-ai/themes`. This module is what is left in\n * the design system: the translation between the catalogue's **canonical** role\n * names and the **shadcn** vocabulary every component here is written against, plus\n * the handful of custom properties this system declares that are presentations of\n * data the catalogue already holds — the `--terminal-*` ramp, the `--editor-*` ramp,\n * and `--chrome`.\n *\n * ## Why it is a bridge and not a copy\n *\n * This file used to hold thirteen themes as hand-written hex literal tables, with its\n * own contrast validator, its own terminal and editor palettes, and its own\n * provenance records. That is a lot of surface to maintain for one consumer of a\n * palette, and it meant every product that wanted the same themes — Adea, Cortana —\n * either imported this package or wrote its own. The catalogue moved out so that\n * there is one answer to \"what is Catppuccin Mocha\", and this file is the part that\n * genuinely belongs to the design system.\n *\n * It is deliberately thin. If you are looking for a colour, it is not here: see\n * `@adea-ai/themes`, whose README explains how the values are produced and whose\n * `NOTICE` records where every palette came from.\n *\n * ## The mapping, and the entry that is not a rename\n *\n * {@link ROLE_FOR} maps canonical roles onto this system's variable vocabulary. One\n * entry will trip a reader: the catalogue's `accent` becomes this system's\n * `primary`, because in the shadcn vocabulary `--primary` is the action colour — the\n * fill of a primary button, the thing a focus ring is drawn in — while `--accent` is\n * a low-contrast hover wash. The catalogue's `accent` is the former, so it goes to\n * `--primary`, and `--accent` is filled from `surfaceHover`, which is what shadcn\n * components actually use it for.\n */\n\nimport {\n ACCENTS,\n accentRoles,\n chartSeries,\n getAccent,\n hasTheme,\n statusForeground,\n tint,\n primaryHover,\n primarySubtleCss,\n syntaxRoles,\n themes as catalogue,\n themesByAppearance,\n validateCatalogue,\n type AdeaThemeRecord,\n type ContrastFinding,\n} from '@adea-ai/themes'\n\nexport type ThemeAppearance = 'light' | 'dark'\n\n/**\n * The surface and text roles, in shadcn's vocabulary.\n *\n * Named to match the components below, which is why they differ from the\n * catalogue's: these are this system's variable names, and renaming them would mean\n * touching every component in the library for no gain.\n */\nexport type ThemeColors = {\n background: string\n foreground: string\n card: string\n cardForeground: string\n popover: string\n popoverForeground: string\n primary: string\n primaryForeground: string\n secondary: string\n secondaryForeground: string\n muted: string\n mutedForeground: string\n accent: string\n accentForeground: string\n destructive: string\n destructiveForeground: string\n destructiveSubtle: string\n success: string\n successForeground: string\n successSubtle: string\n warning: string\n warningForeground: string\n warningSubtle: string\n info: string\n infoForeground: string\n infoSubtle: string\n border: string\n input: string\n ring: string\n sidebar: string\n sidebarForeground: string\n sidebarAccent: string\n sidebarBorder: string\n}\n\n/** The sixteen ANSI colours a terminal needs, plus its cursor and selection. */\nexport type ThemeTerminalPalette = {\n background: string\n foreground: string\n cursor: string\n selection: string\n black: string\n red: string\n green: string\n yellow: string\n blue: string\n magenta: string\n cyan: string\n white: string\n brightBlack: string\n brightRed: string\n brightGreen: string\n brightYellow: string\n brightBlue: string\n brightMagenta: string\n brightCyan: string\n brightWhite: string\n}\n\n/** The syntax roles a code view needs. */\nexport type ThemeEditorPalette = {\n keyword: string\n string: string\n number: string\n comment: string\n function: string\n variable: string\n type: string\n tag: string\n attribute: string\n operator: string\n heading: string\n link: string\n diffAdd: string\n diffDelete: string\n diffHunk: string\n searchMatch: string\n}\n\n/** Where a palette came from, and the terms it is used under. */\nexport type ThemeProvenance = {\n /** The project or person the palette belongs to. */\n source: string\n url: string\n /** An SPDX identifier. Every palette in this catalogue is permissive. */\n license: string\n}\n\nexport type ThemeVariant = {\n /** The `data-theme` value and the id a preference stores. */\n id: string\n /** Groups the variants that came from one project. */\n family: string\n familyLabel: string\n label: string\n appearance: ThemeAppearance\n /** One line, shown in a picker. */\n description: string\n colors: ThemeColors\n terminal: ThemeTerminalPalette\n editor: ThemeEditorPalette\n /** The categorical series, in order. */\n chart: readonly string[]\n provenance: ThemeProvenance\n}\n\n/**\n * Canonical role → this system's `ThemeColors` key.\n *\n * Read by {@link toVariant}. Every key of `ThemeColors` must appear, so a role added\n * to this system fails the type check rather than silently resolving to `undefined`.\n */\nconst ROLE_FOR: Readonly<Record<keyof ThemeColors, keyof AdeaThemeRecord['colors']>> = {\n background: 'background',\n foreground: 'text',\n card: 'surface',\n cardForeground: 'text',\n popover: 'surfaceElevated',\n popoverForeground: 'text',\n // Not a rename — see this module's header.\n primary: 'accent',\n primaryForeground: 'accentForeground',\n // shadcn's `secondary` and `muted` are both the first surface rung used as a fill.\n secondary: 'surface',\n secondaryForeground: 'text',\n muted: 'surface',\n mutedForeground: 'textMuted',\n // shadcn's `accent` is a hover wash, which is exactly `surfaceHover`.\n accent: 'surfaceHover',\n accentForeground: 'text',\n destructive: 'error',\n // Overwritten below from the measured pairing; nominal here so the table is total.\n destructiveForeground: 'error',\n destructiveSubtle: 'error',\n success: 'success',\n successForeground: 'success',\n successSubtle: 'success',\n warning: 'warning',\n warningForeground: 'warning',\n warningSubtle: 'warning',\n info: 'info',\n infoForeground: 'info',\n infoSubtle: 'info',\n border: 'border',\n input: 'border',\n ring: 'accent',\n sidebar: 'surface',\n sidebarForeground: 'text',\n sidebarAccent: 'surfaceHover',\n sidebarBorder: 'border',\n}\n\n/** Builds the design system's view of one catalogue entry. */\nfunction toVariant(theme: AdeaThemeRecord): ThemeVariant {\n const colors = {} as ThemeColors\n for (const key of Object.keys(ROLE_FOR) as (keyof ThemeColors)[]) {\n colors[key] = theme.colors[ROLE_FOR[key]]\n }\n // The label on a solid destructive fill is measured rather than mapped: on a bright\n // red it is black and on a deep red it is white, and using the body text would put\n // white on a mid-tone red at about 3:1.\n colors.destructiveForeground = statusForeground(theme, 'error')\n colors.destructiveSubtle = tint(theme.colors.error, theme.colors.background)\n colors.successForeground = statusForeground(theme, 'success')\n colors.successSubtle = tint(theme.colors.success, theme.colors.background)\n colors.warningForeground = statusForeground(theme, 'warning')\n colors.warningSubtle = tint(theme.colors.warning, theme.colors.background)\n colors.infoForeground = statusForeground(theme, 'info')\n colors.infoSubtle = tint(theme.colors.info, theme.colors.background)\n\n const syntax = syntaxRoles(theme)\n\n return {\n id: theme.id,\n family: theme.family,\n familyLabel: theme.familyLabel,\n label: theme.label,\n appearance: theme.appearance,\n description: theme.description,\n colors,\n terminal: {\n // The embedded terminal uses the theme's own canvas rather than a palette of its\n // own. The ANSI colours came from the palette that produced the canvas, so they\n // were chosen against it; a terminal on a different background would be the one\n // surface in the application not lit by the active theme.\n background: theme.colors.background,\n foreground: theme.colors.foreground,\n cursor: theme.cursor,\n selection: theme.selection,\n ...theme.ansi,\n },\n editor: {\n keyword: syntax.keyword,\n string: syntax.string,\n number: syntax.number,\n comment: syntax.comment,\n function: syntax.function,\n variable: syntax.variable,\n type: syntax.type,\n tag: syntax.tag,\n attribute: syntax.attribute,\n operator: syntax.operator,\n heading: syntax.heading,\n link: syntax.link,\n diffAdd: syntax.diffAdd,\n diffDelete: syntax.diffDelete,\n diffHunk: syntax.diffHunk,\n searchMatch: syntax.searchMatch,\n },\n chart: chartSeries(theme),\n provenance: {\n source: theme.provenance.project,\n url: theme.provenance.url,\n license: theme.provenance.license,\n },\n }\n}\n\n/** The catalogue, in catalogue order. */\nexport const builtinThemes: readonly ThemeVariant[] = Object.freeze(catalogue.map(toVariant))\n\nexport function themeById(id: string): ThemeVariant | undefined {\n if (!hasTheme(id)) return undefined\n return builtinThemes.find((theme) => theme.id === id)\n}\n\n/** The variants of one appearance, which is what a picker for that mode shows. */\nexport function themesForAppearance(appearance: ThemeAppearance): readonly ThemeVariant[] {\n const ids = new Set(themesByAppearance(appearance).map((theme) => theme.id))\n return builtinThemes.filter((theme) => ids.has(theme.id))\n}\n\n/** The families in the catalogue, in catalogue order. */\nexport function themeFamilies(): { family: string; label: string; themes: ThemeVariant[] }[] {\n const families = new Map<string, { family: string; label: string; themes: ThemeVariant[] }>()\n for (const theme of builtinThemes) {\n const entry = families.get(theme.family) ?? {\n family: theme.family,\n label: theme.familyLabel,\n themes: [],\n }\n entry.themes.push(theme)\n families.set(theme.family, entry)\n }\n return [...families.values()]\n}\n\n/** The accent presets, in the order a picker should show them. */\nexport const accents = ACCENTS\n\n/**\n * The properties an accent selection overrides, as CSS custom properties.\n *\n * ## Why this exists rather than relying on the `[data-accent]` blocks\n *\n * `theme.css` carries a `[data-accent='…']` block per preset, and those blocks are\n * correct — but they are unreachable at runtime. `ThemeProvider` writes a theme's\n * whole role set onto `<html>` as *inline* custom properties, and an inline\n * declaration outranks any stylesheet selector regardless of specificity. The\n * attribute was set, the rules existed, the values were right, and every one of the\n * seven accents rendered as the same blue.\n *\n * The blocks are kept, because they are what styles the window between the document\n * arriving and the provider mounting — which is the whole reason `themeScript`\n * exists. But the authoritative value has to be applied by the same code that\n * applies the theme, from the same source, or the two can drift again. So both the\n * provider and the CSS generator call `accentRoles` out of `@adea-ai/themes`, and\n * `tests/appearance-axes.test.ts` asserts the two agree value for value.\n *\n * Returns `undefined` for `theme` — the variant's own primary — and for an id the\n * catalogue does not have, so a stale stored preference falls back to the theme\n * rather than blanking the primary.\n */\nexport function accentVariables(\n accentId: string,\n appearance: ThemeAppearance\n): Record<string, string> | undefined {\n if (accentId === 'theme') return undefined\n const preset = getAccent(accentId)\n if (!preset) return undefined\n\n const roles = accentRoles(preset, appearance)\n return {\n '--primary': roles.primary,\n '--primary-foreground': roles.primaryForeground,\n '--primary-hover': roles.primaryHover,\n '--primary-subtle': roles.primarySubtle,\n '--ring': roles.ring,\n }\n}\n\n/**\n * The roles a variant sets, as CSS custom properties.\n *\n * The one place that knows the mapping from a theme's roles to this system's variable\n * names. A provider applies this; nothing else repeats it. The `--terminal-*` and\n * `--editor-*` ramps are presentations of the catalogue's ANSI and syntax data rather\n * than separate roles, which is why they are built here and not in the catalogue.\n */\nexport function themeCssVariables(theme: ThemeVariant): Record<string, string> {\n const c = theme.colors\n const t = theme.terminal\n const e = theme.editor\n return {\n '--background': c.background,\n '--foreground': c.foreground,\n '--card': c.card,\n '--card-foreground': c.cardForeground,\n '--popover': c.popover,\n '--popover-foreground': c.popoverForeground,\n '--primary': c.primary,\n '--primary-foreground': c.primaryForeground,\n /*\n * The two tokens derived from the primary, and they are here rather than left to\n * `theme.css` because they must follow `--primary` — which this function writes\n * for *any* theme in the catalogue, not just the two defaults `theme.css` carries.\n *\n * `--primary-hover` is a resolved colour, not a `color-mix()`: a uniform hover\n * step cannot be expressed as a mix (see `primaryHover`). Left out, a theme switch\n * would keep the previous theme's hover on the new theme's primary.\n *\n * `--primary-subtle` is a mix over `--primary`, so it would follow on its own —\n * it is written anyway so the pair is applied together and neither is left to\n * depend on which stylesheet happened to load.\n */\n '--primary-hover': primaryHover(c.primary, theme.appearance),\n '--primary-subtle': primarySubtleCss(theme.appearance),\n '--secondary': c.secondary,\n '--secondary-foreground': c.secondaryForeground,\n '--muted': c.muted,\n '--muted-foreground': c.mutedForeground,\n '--accent': c.accent,\n '--accent-foreground': c.accentForeground,\n '--destructive': c.destructive,\n '--destructive-foreground': c.destructiveForeground,\n '--destructive-subtle': c.destructiveSubtle,\n '--success': c.success,\n '--success-foreground': c.successForeground,\n '--success-subtle': c.successSubtle,\n '--warning': c.warning,\n '--warning-foreground': c.warningForeground,\n '--warning-subtle': c.warningSubtle,\n '--info': c.info,\n '--info-foreground': c.infoForeground,\n '--info-subtle': c.infoSubtle,\n '--border': c.border,\n '--input': c.input,\n '--ring': c.ring,\n '--sidebar': c.sidebar,\n '--sidebar-foreground': c.sidebarForeground,\n '--sidebar-accent': c.sidebarAccent,\n '--sidebar-border': c.sidebarBorder,\n '--sidebar-primary': c.primary,\n '--sidebar-primary-foreground': c.primaryForeground,\n '--sidebar-ring': c.ring,\n '--sidebar-muted-foreground': c.mutedForeground,\n '--surface-sunken': c.muted,\n '--surface-hover': c.accent,\n '--surface-active': c.border,\n '--chrome': c.background,\n '--terminal-background': t.background,\n '--terminal-foreground': t.foreground,\n '--terminal-cursor': t.cursor,\n '--terminal-selection': t.selection,\n '--terminal-ansi-black': t.black,\n '--terminal-ansi-red': t.red,\n '--terminal-ansi-green': t.green,\n '--terminal-ansi-yellow': t.yellow,\n '--terminal-ansi-blue': t.blue,\n '--terminal-ansi-magenta': t.magenta,\n '--terminal-ansi-cyan': t.cyan,\n '--terminal-ansi-white': t.white,\n '--terminal-ansi-bright-black': t.brightBlack,\n '--terminal-ansi-bright-red': t.brightRed,\n '--terminal-ansi-bright-green': t.brightGreen,\n '--terminal-ansi-bright-yellow': t.brightYellow,\n '--terminal-ansi-bright-blue': t.brightBlue,\n '--terminal-ansi-bright-magenta': t.brightMagenta,\n '--terminal-ansi-bright-cyan': t.brightCyan,\n '--terminal-ansi-bright-white': t.brightWhite,\n '--editor-keyword': e.keyword,\n '--editor-string': e.string,\n '--editor-number': e.number,\n '--editor-comment': e.comment,\n '--editor-function': e.function,\n '--editor-variable': e.variable,\n '--editor-type': e.type,\n '--editor-tag': e.tag,\n '--editor-attribute': e.attribute,\n '--editor-operator': e.operator,\n '--editor-heading': e.heading,\n '--editor-link': e.link,\n '--editor-diff-add': e.diffAdd,\n '--editor-diff-delete': e.diffDelete,\n '--editor-diff-hunk': e.diffHunk,\n '--editor-search-match': e.searchMatch,\n '--chart-1': theme.chart[0] ?? c.primary,\n '--chart-2': theme.chart[1] ?? c.info,\n '--chart-3': theme.chart[2] ?? c.success,\n '--chart-4': theme.chart[3] ?? c.warning,\n '--chart-5': theme.chart[4] ?? c.destructive,\n '--chart-6': theme.chart[5] ?? c.mutedForeground,\n }\n}\n\n/* ---------------------------------------------------------------------------\n * Validation\n *\n * Delegated. The floors are the catalogue's, because they are what makes the\n * catalogue able to hold other people's palettes at all, and a second set of floors\n * here would be a second answer to the same question — and the one that drifts.\n * ------------------------------------------------------------------------- */\n\nexport type ThemeFinding = {\n themeId: string\n role: string\n message: string\n}\n\nfunction toFinding(finding: ContrastFinding): ThemeFinding {\n return { themeId: finding.themeId, role: finding.role, message: finding.message }\n}\n\n/** Validates one variant. The floors, and the reasoning behind them, live in the catalogue. */\nexport function validateTheme(theme: ThemeVariant): ThemeFinding[] {\n const record = catalogue.find((entry) => entry.id === theme.id)\n if (!record) {\n return [{ themeId: theme.id, role: 'id', message: `${theme.id} is not in the catalogue` }]\n }\n return validateCatalogue([record]).map(toFinding)\n}\n\n/** Validates the whole registry, including the catalogue-level invariants. */\nexport function validateThemeRegistry(\n themes: readonly ThemeVariant[] = builtinThemes\n): ThemeFinding[] {\n const records = themes\n .map((theme) => catalogue.find((entry) => entry.id === theme.id))\n .filter((record): record is AdeaThemeRecord => !!record)\n\n const orphaned = themes\n .filter((theme) => !hasTheme(theme.id))\n .map((theme) => ({\n themeId: theme.id,\n role: 'id',\n message: `${theme.id} is in the registry but not in the catalogue`,\n }))\n\n return [...orphaned, ...validateCatalogue(records).map(toFinding)]\n}\n\nexport const defaultLightThemeId = 'adea-light'\nexport const defaultDarkThemeId = 'adea-dark'\n\n/** Re-exported so a consumer measuring a colour does not need a second import. */\nexport { contrastRatio } from '@adea-ai/themes'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+KA,IAAM,WAAiF;CACrF,YAAY;CACZ,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,SAAS;CACT,mBAAmB;CAEnB,SAAS;CACT,mBAAmB;CAEnB,WAAW;CACX,qBAAqB;CACrB,OAAO;CACP,iBAAiB;CAEjB,QAAQ;CACR,kBAAkB;CAClB,aAAa;CAEb,uBAAuB;CACvB,mBAAmB;CACnB,SAAS;CACT,mBAAmB;CACnB,eAAe;CACf,SAAS;CACT,mBAAmB;CACnB,eAAe;CACf,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,mBAAmB;CACnB,eAAe;CACf,eAAe;AACjB;;AAGA,SAAS,UAAU,OAAsC;CACvD,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,OAAO,OAAO,MAAM,OAAO,SAAS;CAKtC,OAAO,wBAAwB,iBAAiB,OAAO,OAAO;CAC9D,OAAO,oBAAoB,KAAK,MAAM,OAAO,OAAO,MAAM,OAAO,UAAU;CAC3E,OAAO,oBAAoB,iBAAiB,OAAO,SAAS;CAC5D,OAAO,gBAAgB,KAAK,MAAM,OAAO,SAAS,MAAM,OAAO,UAAU;CACzE,OAAO,oBAAoB,iBAAiB,OAAO,SAAS;CAC5D,OAAO,gBAAgB,KAAK,MAAM,OAAO,SAAS,MAAM,OAAO,UAAU;CACzE,OAAO,iBAAiB,iBAAiB,OAAO,MAAM;CACtD,OAAO,aAAa,KAAK,MAAM,OAAO,MAAM,MAAM,OAAO,UAAU;CAEnE,MAAM,SAAS,YAAY,KAAK;CAEhC,OAAO;EACL,IAAI,MAAM;EACV,QAAQ,MAAM;EACd,aAAa,MAAM;EACnB,OAAO,MAAM;EACb,YAAY,MAAM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gB,cAAc,OAAqC;CACjE,MAAM,SAASA,OAAU,MAAM,UAAU,MAAM,OAAO,MAAM,EAAE;CAC9D,IAAI,CAAC,QACH,OAAO,CAAC;EAAE,SAAS,MAAM;EAAI,MAAM;EAAM,SAAS,GAAG,MAAM,GAAG;CAA0B,CAAC;CAE3F,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,SAAS;AAClD;;AAGA,SAAgB,sBACd,WAAkC,eAClB;CAChB,MAAM,UAAUC,SACb,KAAK,UAAUD,OAAU,MAAM,UAAU,MAAM,OAAO,MAAM,EAAE,CAAC,CAAC,CAChE,QAAQ,WAAsC,CAAC,CAAC,MAAM;CAUzD,OAAO,CAAC,GARSC,SACd,QAAQ,UAAU,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC,CACtC,KAAK,WAAW;EACf,SAAS,MAAM;EACf,MAAM;EACN,SAAS,GAAG,MAAM,GAAG;CACvB,EAES,GAAU,GAAG,kBAAkB,OAAO,CAAC,CAAC,IAAI,SAAS,CAAC;AACnE;AAEA,IAAa,sBAAsB;AACnC,IAAa,qBAAqB"}
|
|
1
|
+
{"version":3,"file":"themes.js","names":["catalogue","themes"],"sources":["../../src/lib/themes.ts"],"sourcesContent":["/**\n * The theme registry, now a bridge.\n *\n * The catalogue itself lives in `@adea-ai/themes`. This module is what is left in\n * the design system: the translation between the catalogue's **canonical** role\n * names and the **shadcn** vocabulary every component here is written against, plus\n * the handful of custom properties this system declares that are presentations of\n * data the catalogue already holds — the `--terminal-*` ramp, the `--editor-*` ramp,\n * and `--chrome`.\n *\n * ## Why it is a bridge and not a copy\n *\n * This file used to hold thirteen themes as hand-written hex literal tables, with its\n * own contrast validator, its own terminal and editor palettes, and its own\n * provenance records. That is a lot of surface to maintain for one consumer of a\n * palette, and it meant every product that wanted the same themes — Adea, Cortana —\n * either imported this package or wrote its own. The catalogue moved out so that\n * there is one answer to \"what is Catppuccin Mocha\", and this file is the part that\n * genuinely belongs to the design system.\n *\n * It is deliberately thin. If you are looking for a colour, it is not here: see\n * `@adea-ai/themes`, whose README explains how the values are produced and whose\n * `NOTICE` records where every palette came from.\n *\n * ## The mapping, and the entry that is not a rename\n *\n * {@link ROLE_FOR} maps canonical roles onto this system's variable vocabulary. One\n * entry will trip a reader: the catalogue's `accent` becomes this system's\n * `primary`, because in the shadcn vocabulary `--primary` is the action colour — the\n * fill of a primary button, the thing a focus ring is drawn in — while `--accent` is\n * a low-contrast hover wash. The catalogue's `accent` is the former, so it goes to\n * `--primary`, and `--accent` is filled from `surfaceHover`, which is what shadcn\n * components actually use it for.\n */\n\nimport {\n ACCENTS,\n accentRoles,\n chartSeries,\n getAccent,\n hasTheme,\n shadcnDestructiveProjection,\n statusForeground,\n tint,\n primaryHover,\n primarySubtleCss,\n syntaxRoles,\n themes as catalogue,\n themesByAppearance,\n validateCatalogue,\n type AdeaThemeRecord,\n type ContrastFinding,\n} from '@adea-ai/themes'\n\nexport type ThemeAppearance = 'light' | 'dark'\n\n/**\n * The surface and text roles, in shadcn's vocabulary.\n *\n * Named to match the components below, which is why they differ from the\n * catalogue's: these are this system's variable names, and renaming them would mean\n * touching every component in the library for no gain.\n */\nexport type ThemeColors = {\n background: string\n foreground: string\n card: string\n cardForeground: string\n popover: string\n popoverForeground: string\n primary: string\n primaryForeground: string\n secondary: string\n secondaryForeground: string\n muted: string\n mutedForeground: string\n accent: string\n accentForeground: string\n destructive: string\n destructiveForeground: string\n destructiveSubtle: string\n /** Contrast-safe solid-action presentation, derived from the canonical error role. */\n destructiveAction: string\n destructiveActionForeground: string\n success: string\n successForeground: string\n successSubtle: string\n warning: string\n warningForeground: string\n warningSubtle: string\n info: string\n infoForeground: string\n infoSubtle: string\n border: string\n input: string\n ring: string\n sidebar: string\n sidebarForeground: string\n sidebarAccent: string\n sidebarBorder: string\n}\n\n/** The sixteen ANSI colours a terminal needs, plus its cursor and selection. */\nexport type ThemeTerminalPalette = {\n background: string\n foreground: string\n cursor: string\n selection: string\n black: string\n red: string\n green: string\n yellow: string\n blue: string\n magenta: string\n cyan: string\n white: string\n brightBlack: string\n brightRed: string\n brightGreen: string\n brightYellow: string\n brightBlue: string\n brightMagenta: string\n brightCyan: string\n brightWhite: string\n}\n\n/** The syntax roles a code view needs. */\nexport type ThemeEditorPalette = {\n keyword: string\n string: string\n number: string\n comment: string\n function: string\n variable: string\n type: string\n tag: string\n attribute: string\n operator: string\n heading: string\n link: string\n diffAdd: string\n diffDelete: string\n diffHunk: string\n searchMatch: string\n}\n\n/** Where a palette came from, and the terms it is used under. */\nexport type ThemeProvenance = {\n /** The project or person the palette belongs to. */\n source: string\n url: string\n /** An SPDX identifier. Every palette in this catalogue is permissive. */\n license: string\n}\n\nexport type ThemeVariant = {\n /** The `data-theme` value and the id a preference stores. */\n id: string\n /** Groups the variants that came from one project. */\n family: string\n familyLabel: string\n label: string\n appearance: ThemeAppearance\n /** One line, shown in a picker. */\n description: string\n colors: ThemeColors\n terminal: ThemeTerminalPalette\n editor: ThemeEditorPalette\n /** The categorical series, in order. */\n chart: readonly string[]\n provenance: ThemeProvenance\n}\n\n/**\n * Canonical role → this system's `ThemeColors` key.\n *\n * Read by {@link toVariant}. The two derived destructive-action presentation values\n * are intentionally excluded; the shared Themes adapter owns their color math.\n */\ntype ThemeRole = Exclude<keyof ThemeColors, 'destructiveAction' | 'destructiveActionForeground'>\n\nconst ROLE_FOR: Readonly<Record<ThemeRole, keyof AdeaThemeRecord['colors']>> = {\n background: 'background',\n foreground: 'text',\n card: 'surface',\n cardForeground: 'text',\n popover: 'surfaceElevated',\n popoverForeground: 'text',\n // Not a rename — see this module's header.\n primary: 'accent',\n primaryForeground: 'accentForeground',\n // shadcn's `secondary` and `muted` are both the first surface rung used as a fill.\n secondary: 'surface',\n secondaryForeground: 'text',\n muted: 'surface',\n mutedForeground: 'textMuted',\n // shadcn's `accent` is a hover wash, which is exactly `surfaceHover`.\n accent: 'surfaceHover',\n accentForeground: 'text',\n destructive: 'error',\n // Overwritten below from the measured pairing; nominal here so the table is total.\n destructiveForeground: 'error',\n destructiveSubtle: 'error',\n success: 'success',\n successForeground: 'success',\n successSubtle: 'success',\n warning: 'warning',\n warningForeground: 'warning',\n warningSubtle: 'warning',\n info: 'info',\n infoForeground: 'info',\n infoSubtle: 'info',\n border: 'border',\n input: 'border',\n ring: 'accent',\n sidebar: 'surface',\n sidebarForeground: 'text',\n sidebarAccent: 'surfaceHover',\n sidebarBorder: 'border',\n}\n\n/** Builds the design system's view of one catalogue entry. */\nfunction toVariant(theme: AdeaThemeRecord): ThemeVariant {\n const colors = {} as ThemeColors\n for (const key of Object.keys(ROLE_FOR) as ThemeRole[]) {\n colors[key] = theme.colors[ROLE_FOR[key]]\n }\n // Keep the semantic foreground paired with the canonical error role. Filled\n // destructive actions use the distinct projection below so their /90 hover state\n // remains readable without changing icons, borders, or tinted status surfaces.\n colors.destructiveForeground = statusForeground(theme, 'error')\n colors.destructiveSubtle = tint(theme.colors.error, theme.colors.background)\n const destructiveAction = shadcnDestructiveProjection(theme)\n colors.destructiveAction = destructiveAction.fill\n colors.destructiveActionForeground = destructiveAction.foreground\n colors.successForeground = statusForeground(theme, 'success')\n colors.successSubtle = tint(theme.colors.success, theme.colors.background)\n colors.warningForeground = statusForeground(theme, 'warning')\n colors.warningSubtle = tint(theme.colors.warning, theme.colors.background)\n colors.infoForeground = statusForeground(theme, 'info')\n colors.infoSubtle = tint(theme.colors.info, theme.colors.background)\n\n const syntax = syntaxRoles(theme)\n\n return {\n id: theme.id,\n family: theme.family,\n familyLabel: theme.familyLabel,\n label: theme.label,\n appearance: theme.appearance,\n description: theme.description,\n colors,\n terminal: {\n // The embedded terminal uses the theme's own canvas rather than a palette of its\n // own. The ANSI colours came from the palette that produced the canvas, so they\n // were chosen against it; a terminal on a different background would be the one\n // surface in the application not lit by the active theme.\n background: theme.colors.background,\n foreground: theme.colors.foreground,\n cursor: theme.cursor,\n selection: theme.selection,\n ...theme.ansi,\n },\n editor: {\n keyword: syntax.keyword,\n string: syntax.string,\n number: syntax.number,\n comment: syntax.comment,\n function: syntax.function,\n variable: syntax.variable,\n type: syntax.type,\n tag: syntax.tag,\n attribute: syntax.attribute,\n operator: syntax.operator,\n heading: syntax.heading,\n link: syntax.link,\n diffAdd: syntax.diffAdd,\n diffDelete: syntax.diffDelete,\n diffHunk: syntax.diffHunk,\n searchMatch: syntax.searchMatch,\n },\n chart: chartSeries(theme),\n provenance: {\n source: theme.provenance.project,\n url: theme.provenance.url,\n license: theme.provenance.license,\n },\n }\n}\n\n/** The catalogue, in catalogue order. */\nexport const builtinThemes: readonly ThemeVariant[] = Object.freeze(catalogue.map(toVariant))\n\nexport function themeById(id: string): ThemeVariant | undefined {\n if (!hasTheme(id)) return undefined\n return builtinThemes.find((theme) => theme.id === id)\n}\n\n/** The variants of one appearance, which is what a picker for that mode shows. */\nexport function themesForAppearance(appearance: ThemeAppearance): readonly ThemeVariant[] {\n const ids = new Set(themesByAppearance(appearance).map((theme) => theme.id))\n return builtinThemes.filter((theme) => ids.has(theme.id))\n}\n\n/** The families in the catalogue, in catalogue order. */\nexport function themeFamilies(): { family: string; label: string; themes: ThemeVariant[] }[] {\n const families = new Map<string, { family: string; label: string; themes: ThemeVariant[] }>()\n for (const theme of builtinThemes) {\n const entry = families.get(theme.family) ?? {\n family: theme.family,\n label: theme.familyLabel,\n themes: [],\n }\n entry.themes.push(theme)\n families.set(theme.family, entry)\n }\n return [...families.values()]\n}\n\n/** The accent presets, in the order a picker should show them. */\nexport const accents = ACCENTS\n\n/**\n * The properties an accent selection overrides, as CSS custom properties.\n *\n * ## Why this exists rather than relying on the `[data-accent]` blocks\n *\n * `theme.css` carries a `[data-accent='…']` block per preset, and those blocks are\n * correct — but they are unreachable at runtime. `ThemeProvider` writes a theme's\n * whole role set onto `<html>` as *inline* custom properties, and an inline\n * declaration outranks any stylesheet selector regardless of specificity. The\n * attribute was set, the rules existed, the values were right, and every one of the\n * seven accents rendered as the same blue.\n *\n * The blocks are kept, because they are what styles the window between the document\n * arriving and the provider mounting — which is the whole reason `themeScript`\n * exists. But the authoritative value has to be applied by the same code that\n * applies the theme, from the same source, or the two can drift again. So both the\n * provider and the CSS generator call `accentRoles` out of `@adea-ai/themes`, and\n * `tests/appearance-axes.test.ts` asserts the two agree value for value.\n *\n * Returns `undefined` for `theme` — the variant's own primary — and for an id the\n * catalogue does not have, so a stale stored preference falls back to the theme\n * rather than blanking the primary.\n */\nexport function accentVariables(\n accentId: string,\n appearance: ThemeAppearance\n): Record<string, string> | undefined {\n if (accentId === 'theme') return undefined\n const preset = getAccent(accentId)\n if (!preset) return undefined\n\n const roles = accentRoles(preset, appearance)\n return {\n '--primary': roles.primary,\n '--primary-foreground': roles.primaryForeground,\n '--primary-hover': roles.primaryHover,\n '--primary-subtle': roles.primarySubtle,\n '--ring': roles.ring,\n }\n}\n\n/**\n * The roles a variant sets, as CSS custom properties.\n *\n * The one place that knows the mapping from a theme's roles to this system's variable\n * names. A provider applies this; nothing else repeats it. The `--terminal-*` and\n * `--editor-*` ramps are presentations of the catalogue's ANSI and syntax data rather\n * than separate roles, which is why they are built here and not in the catalogue.\n */\nexport function themeCssVariables(theme: ThemeVariant): Record<string, string> {\n const c = theme.colors\n const t = theme.terminal\n const e = theme.editor\n return {\n '--background': c.background,\n '--foreground': c.foreground,\n '--card': c.card,\n '--card-foreground': c.cardForeground,\n '--popover': c.popover,\n '--popover-foreground': c.popoverForeground,\n '--primary': c.primary,\n '--primary-foreground': c.primaryForeground,\n /*\n * The two tokens derived from the primary, and they are here rather than left to\n * `theme.css` because they must follow `--primary` — which this function writes\n * for *any* theme in the catalogue, not just the two defaults `theme.css` carries.\n *\n * `--primary-hover` is a resolved colour, not a `color-mix()`: a uniform hover\n * step cannot be expressed as a mix (see `primaryHover`). Left out, a theme switch\n * would keep the previous theme's hover on the new theme's primary.\n *\n * `--primary-subtle` is a mix over `--primary`, so it would follow on its own —\n * it is written anyway so the pair is applied together and neither is left to\n * depend on which stylesheet happened to load.\n */\n '--primary-hover': primaryHover(c.primary, theme.appearance),\n '--primary-subtle': primarySubtleCss(theme.appearance),\n '--secondary': c.secondary,\n '--secondary-foreground': c.secondaryForeground,\n '--muted': c.muted,\n '--muted-foreground': c.mutedForeground,\n '--accent': c.accent,\n '--accent-foreground': c.accentForeground,\n '--destructive': c.destructive,\n '--destructive-foreground': c.destructiveForeground,\n '--destructive-subtle': c.destructiveSubtle,\n '--destructive-action': c.destructiveAction,\n '--destructive-action-foreground': c.destructiveActionForeground,\n '--success': c.success,\n '--success-foreground': c.successForeground,\n '--success-subtle': c.successSubtle,\n '--warning': c.warning,\n '--warning-foreground': c.warningForeground,\n '--warning-subtle': c.warningSubtle,\n '--info': c.info,\n '--info-foreground': c.infoForeground,\n '--info-subtle': c.infoSubtle,\n '--border': c.border,\n '--input': c.input,\n '--ring': c.ring,\n '--sidebar': c.sidebar,\n '--sidebar-foreground': c.sidebarForeground,\n '--sidebar-accent': c.sidebarAccent,\n '--sidebar-border': c.sidebarBorder,\n '--sidebar-primary': c.primary,\n '--sidebar-primary-foreground': c.primaryForeground,\n '--sidebar-ring': c.ring,\n '--sidebar-muted-foreground': c.mutedForeground,\n '--surface-sunken': c.muted,\n '--surface-hover': c.accent,\n '--surface-active': c.border,\n '--chrome': c.background,\n '--terminal-background': t.background,\n '--terminal-foreground': t.foreground,\n '--terminal-cursor': t.cursor,\n '--terminal-selection': t.selection,\n '--terminal-ansi-black': t.black,\n '--terminal-ansi-red': t.red,\n '--terminal-ansi-green': t.green,\n '--terminal-ansi-yellow': t.yellow,\n '--terminal-ansi-blue': t.blue,\n '--terminal-ansi-magenta': t.magenta,\n '--terminal-ansi-cyan': t.cyan,\n '--terminal-ansi-white': t.white,\n '--terminal-ansi-bright-black': t.brightBlack,\n '--terminal-ansi-bright-red': t.brightRed,\n '--terminal-ansi-bright-green': t.brightGreen,\n '--terminal-ansi-bright-yellow': t.brightYellow,\n '--terminal-ansi-bright-blue': t.brightBlue,\n '--terminal-ansi-bright-magenta': t.brightMagenta,\n '--terminal-ansi-bright-cyan': t.brightCyan,\n '--terminal-ansi-bright-white': t.brightWhite,\n '--editor-keyword': e.keyword,\n '--editor-string': e.string,\n '--editor-number': e.number,\n '--editor-comment': e.comment,\n '--editor-function': e.function,\n '--editor-variable': e.variable,\n '--editor-type': e.type,\n '--editor-tag': e.tag,\n '--editor-attribute': e.attribute,\n '--editor-operator': e.operator,\n '--editor-heading': e.heading,\n '--editor-link': e.link,\n '--editor-diff-add': e.diffAdd,\n '--editor-diff-delete': e.diffDelete,\n '--editor-diff-hunk': e.diffHunk,\n '--editor-search-match': e.searchMatch,\n '--chart-1': theme.chart[0] ?? c.primary,\n '--chart-2': theme.chart[1] ?? c.info,\n '--chart-3': theme.chart[2] ?? c.success,\n '--chart-4': theme.chart[3] ?? c.warning,\n '--chart-5': theme.chart[4] ?? c.destructive,\n '--chart-6': theme.chart[5] ?? c.mutedForeground,\n }\n}\n\n/* ---------------------------------------------------------------------------\n * Validation\n *\n * Delegated. The floors are the catalogue's, because they are what makes the\n * catalogue able to hold other people's palettes at all, and a second set of floors\n * here would be a second answer to the same question — and the one that drifts.\n * ------------------------------------------------------------------------- */\n\nexport type ThemeFinding = {\n themeId: string\n role: string\n message: string\n}\n\nfunction toFinding(finding: ContrastFinding): ThemeFinding {\n return { themeId: finding.themeId, role: finding.role, message: finding.message }\n}\n\n/** Validates one variant. The floors, and the reasoning behind them, live in the catalogue. */\nexport function validateTheme(theme: ThemeVariant): ThemeFinding[] {\n const record = catalogue.find((entry) => entry.id === theme.id)\n if (!record) {\n return [{ themeId: theme.id, role: 'id', message: `${theme.id} is not in the catalogue` }]\n }\n return validateCatalogue([record]).map(toFinding)\n}\n\n/** Validates the whole registry, including the catalogue-level invariants. */\nexport function validateThemeRegistry(\n themes: readonly ThemeVariant[] = builtinThemes\n): ThemeFinding[] {\n const records = themes\n .map((theme) => catalogue.find((entry) => entry.id === theme.id))\n .filter((record): record is AdeaThemeRecord => !!record)\n\n const orphaned = themes\n .filter((theme) => !hasTheme(theme.id))\n .map((theme) => ({\n themeId: theme.id,\n role: 'id',\n message: `${theme.id} is in the registry but not in the catalogue`,\n }))\n\n return [...orphaned, ...validateCatalogue(records).map(toFinding)]\n}\n\nexport const defaultLightThemeId = 'adea-light'\nexport const defaultDarkThemeId = 'adea-dark'\n\n/** Re-exported so a consumer measuring a colour does not need a second import. */\nexport { contrastRatio } from '@adea-ai/themes'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqLA,IAAM,WAAyE;CAC7E,YAAY;CACZ,YAAY;CACZ,MAAM;CACN,gBAAgB;CAChB,SAAS;CACT,mBAAmB;CAEnB,SAAS;CACT,mBAAmB;CAEnB,WAAW;CACX,qBAAqB;CACrB,OAAO;CACP,iBAAiB;CAEjB,QAAQ;CACR,kBAAkB;CAClB,aAAa;CAEb,uBAAuB;CACvB,mBAAmB;CACnB,SAAS;CACT,mBAAmB;CACnB,eAAe;CACf,SAAS;CACT,mBAAmB;CACnB,eAAe;CACf,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,QAAQ;CACR,OAAO;CACP,MAAM;CACN,SAAS;CACT,mBAAmB;CACnB,eAAe;CACf,eAAe;AACjB;;AAGA,SAAS,UAAU,OAAsC;CACvD,MAAM,SAAS,CAAC;CAChB,KAAK,MAAM,OAAO,OAAO,KAAK,QAAQ,GACpC,OAAO,OAAO,MAAM,OAAO,SAAS;CAKtC,OAAO,wBAAwB,iBAAiB,OAAO,OAAO;CAC9D,OAAO,oBAAoB,KAAK,MAAM,OAAO,OAAO,MAAM,OAAO,UAAU;CAC3E,MAAM,oBAAoB,4BAA4B,KAAK;CAC3D,OAAO,oBAAoB,kBAAkB;CAC7C,OAAO,8BAA8B,kBAAkB;CACvD,OAAO,oBAAoB,iBAAiB,OAAO,SAAS;CAC5D,OAAO,gBAAgB,KAAK,MAAM,OAAO,SAAS,MAAM,OAAO,UAAU;CACzE,OAAO,oBAAoB,iBAAiB,OAAO,SAAS;CAC5D,OAAO,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E,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,8DAA8D;IAC9D,WAAW,EAAE,MAAM,CAAA;IACnB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAA;CACd,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,SAAS,YAAY,EAQ/C,CAAA;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,oFAAoF;IACpF,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,gDAAgD;IAChD,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,SAAS,UAAU,EA+B3C,CAAA;AAEF,qCAAqC;AACrC,eAAO,MAAM,YAAY;;;;;;;;CAQf,CAAA;AAEV,yDAAyD;AACzD,eAAO,MAAM,SAAS,EAAE,eAAe,EAAuC,CAAA;AAE9E;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAAe,CAAA"}
|
package/dist/lib/tokens.js
CHANGED
|
@@ -172,13 +172,13 @@ var colorTokens = [
|
|
|
172
172
|
name: "destructive",
|
|
173
173
|
kind: "color",
|
|
174
174
|
themed: true,
|
|
175
|
-
description: "
|
|
175
|
+
description: "The canonical error hue for semantic status indicators and tinted notices."
|
|
176
176
|
},
|
|
177
177
|
{
|
|
178
178
|
name: "destructive-foreground",
|
|
179
179
|
kind: "color",
|
|
180
180
|
themed: true,
|
|
181
|
-
description: "
|
|
181
|
+
description: "Text on the canonical error hue; solid actions use `destructive-action-foreground`."
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
184
|
name: "destructive-subtle",
|
|
@@ -186,6 +186,18 @@ var colorTokens = [
|
|
|
186
186
|
themed: true,
|
|
187
187
|
description: "Opaque destructive tint against the canvas; subtle labels use foreground."
|
|
188
188
|
},
|
|
189
|
+
{
|
|
190
|
+
name: "destructive-action",
|
|
191
|
+
kind: "color",
|
|
192
|
+
themed: true,
|
|
193
|
+
description: "Contrast-safe solid fill for destructive actions, derived from the error role."
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
name: "destructive-action-foreground",
|
|
197
|
+
kind: "color",
|
|
198
|
+
themed: true,
|
|
199
|
+
description: "Text on the destructive action fill and its 90% hover composition."
|
|
200
|
+
},
|
|
189
201
|
{
|
|
190
202
|
name: "success",
|
|
191
203
|
kind: "color",
|
package/dist/lib/tokens.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/lib/tokens.ts"],"sourcesContent":["/**\n * The design system's token manifest.\n *\n * `theme.css` is the source of truth for token *values*. This file is the\n * source of truth for token *names and meaning* — what each one is for, and\n * which ones a theme may vary.\n *\n * It exists because a manifest that is only documentation rots. Two things read\n * it instead:\n *\n * - the token galleries in Storybook, so the review surface shows every token\n * rather than the ones an author remembered;\n * - `tests/tokens.test.ts`, which parses `theme.css` and fails when a token\n * is declared in one place and missing from the other.\n *\n * That pairing is what makes \"every token is documented and every documented\n * token exists\" a property the build enforces rather than a promise.\n */\n\nimport { ACCENTS } from '@adea-ai/themes'\n\nexport type TokenKind =\n | 'color'\n | 'dimension'\n | 'font-family'\n | 'number'\n | 'duration'\n | 'easing'\n | 'shadow'\n | 'text'\n\nexport type TokenDefinition = {\n /** The custom property name, without the leading `--`. */\n name: string\n kind: TokenKind\n /** One line: what this token is for. Shown in the gallery. */\n description: string\n /** True when the light and dark themes give it different values. */\n themed?: boolean\n}\n\n/**\n * Colour roles, in the order they appear in a page: surfaces first, then text,\n * then the lines between them, then the semantic fills. The order is the\n * documentation — reading the gallery top to bottom walks the surface ladder.\n */\nexport const colorTokens: TokenDefinition[] = [\n // Surfaces\n {\n name: 'background',\n kind: 'color',\n themed: true,\n description: 'The canvas every panel sits on.',\n },\n {\n name: 'foreground',\n kind: 'color',\n themed: true,\n description: 'Default body text on the canvas.',\n },\n {\n name: 'card',\n kind: 'color',\n themed: true,\n description: 'A panel or card raised one rung above the canvas.',\n },\n { name: 'card-foreground', kind: 'color', themed: true, description: 'Text on `card`.' },\n {\n name: 'popover',\n kind: 'color',\n themed: true,\n description: 'A floating surface: dialog, menu, popover, tooltip-free.',\n },\n { name: 'popover-foreground', kind: 'color', themed: true, description: 'Text on `popover`.' },\n {\n name: 'surface',\n kind: 'color',\n themed: true,\n description: 'Alias of `background`, for code that means \"a surface\" not \"the page\".',\n },\n {\n name: 'surface-sunken',\n kind: 'color',\n themed: true,\n description: 'A well: code blocks, inset lists, empty states.',\n },\n {\n name: 'surface-raised',\n kind: 'color',\n themed: true,\n description: 'Alias of `card`, for panels that sit on the canvas.',\n },\n {\n name: 'surface-overlay',\n kind: 'color',\n themed: true,\n description: 'Alias of `popover`, for floating layers.',\n },\n {\n name: 'surface-hover',\n kind: 'color',\n themed: true,\n description: 'The hover fill shared by rows, menu items and ghost controls.',\n },\n {\n name: 'surface-active',\n kind: 'color',\n themed: true,\n description: 'The pressed/selected fill, one rung past hover.',\n },\n {\n name: 'chrome',\n kind: 'color',\n themed: true,\n description: 'Window chrome: the top bar and its frosted fill.',\n },\n {\n name: 'chrome-alpha',\n kind: 'number',\n themed: true,\n description: 'Opacity of the chrome fill behind a blur.',\n },\n\n // The brand action\n {\n name: 'primary',\n kind: 'color',\n themed: true,\n description: 'The Adea emerald. The one primary action in a view.',\n },\n {\n name: 'primary-foreground',\n kind: 'color',\n themed: true,\n description: 'Label on `primary`. Black in dark, white in light — the accent flips polarity.',\n },\n {\n name: 'primary-hover',\n kind: 'color',\n themed: true,\n description: 'Hover rung for a primary action.',\n },\n {\n name: 'primary-subtle',\n kind: 'color',\n themed: true,\n description: 'Tinted primary fill: selected rows, focus rings, subtle buttons.',\n },\n\n {\n name: 'secondary',\n kind: 'color',\n themed: true,\n description: 'A quieter filled surface for a secondary action.',\n },\n {\n name: 'secondary-foreground',\n kind: 'color',\n themed: true,\n description: 'Label on `secondary`.',\n },\n {\n name: 'muted',\n kind: 'color',\n themed: true,\n description: 'A neutral fill: skeletons, inert chips, table footers.',\n },\n {\n name: 'muted-foreground',\n kind: 'color',\n themed: true,\n description: 'De-emphasised text. Measured to clear 4.5:1 on both `background` and `card`.',\n },\n {\n name: 'accent',\n kind: 'color',\n themed: true,\n description: \"shadcn's hover-surface accent. Not the brand colour — that is `primary`.\",\n },\n { name: 'accent-foreground', kind: 'color', themed: true, description: 'Text on `accent`.' },\n\n // Status\n {\n name: 'destructive',\n kind: 'color',\n themed: true,\n description: 'Irreversible or dangerous actions.',\n },\n {\n name: 'destructive-foreground',\n kind: 'color',\n themed: true,\n description: 'Label on `destructive`.',\n },\n {\n name: 'destructive-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque destructive tint against the canvas; subtle labels use foreground.',\n },\n { name: 'success', kind: 'color', themed: true, description: 'A completed or healthy state.' },\n { name: 'success-foreground', kind: 'color', themed: true, description: 'Label on `success`.' },\n {\n name: 'success-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque success tint against the canvas; subtle labels use foreground.',\n },\n {\n name: 'warning',\n kind: 'color',\n themed: true,\n description: 'Something needs attention but is not broken.',\n },\n { name: 'warning-foreground', kind: 'color', themed: true, description: 'Label on `warning`.' },\n {\n name: 'warning-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque warning tint against the canvas; subtle labels use foreground.',\n },\n { name: 'info', kind: 'color', themed: true, description: 'Neutral information.' },\n { name: 'info-foreground', kind: 'color', themed: true, description: 'Label on `info`.' },\n {\n name: 'info-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque info tint against the canvas; subtle labels use foreground.',\n },\n\n // Lines\n {\n name: 'border',\n kind: 'color',\n themed: true,\n description: 'Every hairline: panel edges, dividers, card outlines.',\n },\n {\n name: 'input',\n kind: 'color',\n themed: true,\n description:\n 'The edge of an editable control. A rung stronger than `border` so a field is findable.',\n },\n {\n name: 'ring',\n kind: 'color',\n themed: true,\n description: 'The focus ring. Always paired with `primary-subtle` as its glow.',\n },\n\n // Theme-invariant glass\n {\n name: 'scrim',\n kind: 'color',\n description: 'Dark glass for overlays and on-screen controls. Same in both themes.',\n },\n { name: 'scrim-foreground', kind: 'color', description: 'Text drawn on `scrim`.' },\n { name: 'scrim-edge', kind: 'color', description: 'The hairline drawn on `scrim`.' },\n\n // Diff and code\n { name: 'diff-add', kind: 'color', themed: true, description: 'Background of an added line.' },\n {\n name: 'diff-add-foreground',\n kind: 'color',\n themed: true,\n description: 'Text of an added line.',\n },\n {\n name: 'diff-delete',\n kind: 'color',\n themed: true,\n description: 'Background of a removed line.',\n },\n {\n name: 'diff-delete-foreground',\n kind: 'color',\n themed: true,\n description: 'Text of a removed line.',\n },\n { name: 'diff-hunk', kind: 'color', themed: true, description: 'Background of a hunk header.' },\n {\n name: 'diff-hunk-foreground',\n kind: 'color',\n themed: true,\n description: 'Text of a hunk header.',\n },\n {\n name: 'diff-meta-foreground',\n kind: 'color',\n themed: true,\n description: 'File headers and line numbers in a diff.',\n },\n\n // Charts\n {\n name: 'chart-1',\n kind: 'color',\n themed: true,\n description: 'Categorical series 1. The set is closed at six.',\n },\n { name: 'chart-2', kind: 'color', themed: true, description: 'Categorical series 2.' },\n { name: 'chart-3', kind: 'color', themed: true, description: 'Categorical series 3.' },\n { name: 'chart-4', kind: 'color', themed: true, description: 'Categorical series 4.' },\n { name: 'chart-5', kind: 'color', themed: true, description: 'Categorical series 5.' },\n { name: 'chart-6', kind: 'color', themed: true, description: 'Categorical series 6.' },\n\n // Sidebar (the shadcn contract, kept whole)\n {\n name: 'sidebar',\n kind: 'color',\n themed: true,\n description: 'The rail and sidebar surface, tinted against the canvas.',\n },\n {\n name: 'sidebar-foreground',\n kind: 'color',\n themed: true,\n description: 'Default text in the rail and sidebar.',\n },\n {\n name: 'sidebar-primary',\n kind: 'color',\n themed: true,\n description: 'The active destination in the rail.',\n },\n {\n name: 'sidebar-primary-foreground',\n kind: 'color',\n themed: true,\n description: 'Text on the active rail destination.',\n },\n {\n name: 'sidebar-accent',\n kind: 'color',\n themed: true,\n description: 'Hover and selected fill for rail and sidebar rows.',\n },\n {\n name: 'sidebar-accent-foreground',\n kind: 'color',\n themed: true,\n description: 'Text on `sidebar-accent`.',\n },\n {\n name: 'sidebar-border',\n kind: 'color',\n themed: true,\n description: 'The rule between the rail and the canvas.',\n },\n { name: 'sidebar-ring', kind: 'color', themed: true, description: 'Focus ring inside the rail.' },\n {\n name: 'sidebar-muted-foreground',\n kind: 'color',\n themed: true,\n description: 'Rail labels that are not the current destination.',\n },\n]\n\nexport const radiusTokens: TokenDefinition[] = [\n {\n name: 'radius-lg',\n kind: 'dimension',\n description:\n '10px — cards and panels. Also the knob: move this one value to re-round the whole system.',\n },\n { name: 'radius-sm', kind: 'dimension', description: '6px — badges, keyboard keys, menu items.' },\n {\n name: 'radius-md',\n kind: 'dimension',\n description: '8px — every control: buttons, inputs, selects.',\n },\n { name: 'radius-xl', kind: 'dimension', description: '14px — dialogs, menus, sheets.' },\n { name: 'radius-2xl', kind: 'dimension', description: '18px — full-window surfaces and media.' },\n]\n\nexport const typographyTokens: TokenDefinition[] = [\n {\n name: 'font-sans',\n kind: 'font-family',\n description: 'The selected interface face. Space Grotesk unless the font axis says otherwise.',\n },\n {\n name: 'font-mono',\n kind: 'font-family',\n description: 'The selected monospace face. Code, terminals, ids, paths.',\n },\n {\n name: 'font-family-space-grotesk',\n kind: 'font-family',\n description: 'The interface default, and the face the visual language was drawn against.',\n },\n {\n name: 'font-family-jetbrains-mono',\n kind: 'font-family',\n description: 'The monospace default. Code, terminals, diffs.',\n },\n {\n name: 'font-family-geist',\n kind: 'font-family',\n description: 'An alternative interface face. cortana already ships it.',\n },\n {\n name: 'font-family-geist-mono',\n kind: 'font-family',\n description: 'The monospace counterpart to Geist.',\n },\n {\n name: 'font-family-system',\n kind: 'font-family',\n description: \"The platform's own interface face. First-class, not a fallback.\",\n },\n {\n name: 'font-family-system-mono',\n kind: 'font-family',\n description: \"The platform's own monospace face.\",\n },\n {\n name: 'ui-tracking',\n kind: 'text',\n description:\n 'Letter spacing for measured chrome. `normal` on a proportional face, tightened when the UI font is monospace — which is roughly 20% wider at the same size.',\n },\n {\n name: 'ui-word-spacing',\n kind: 'text',\n description:\n \"Word spacing for measured chrome. Mono's space is a full advance-width cell, so a two-word label reads as two floating words without this.\",\n },\n {\n name: 'text-2xs',\n kind: 'text',\n description: '11px — the smallest label the system permits: kbd keys, status bar.',\n },\n { name: 'text-xs', kind: 'text', description: '12px — metadata, badges, secondary rows.' },\n {\n name: 'text-sm',\n kind: 'text',\n description: '14px — the interface default. Body copy, labels, controls.',\n },\n { name: 'text-base', kind: 'text', description: '16px — card titles and dialog titles.' },\n { name: 'text-lg', kind: 'text', description: '18px — a section heading inside a page.' },\n { name: 'text-xl', kind: 'text', description: '20px — a page title.' },\n { name: 'text-2xl', kind: 'text', description: '24px — a display figure.' },\n {\n name: 'text-3xl',\n kind: 'text',\n description: '30px — the largest size in the system. Reserved for an empty-state headline.',\n },\n]\n\n/** Height tokens also size both axes of icon controls through Tailwind's --size\n * namespace. Padding has its own --spacing mapping. Nominal pixel descriptions\n * use a 16px rem; rendered dimensions follow the consumer's root font size. */\nexport const densityTokens: TokenDefinition[] = [\n { name: 'control-height-2xs', kind: 'dimension', description: '20px — an inline chip control.' },\n { name: 'control-height-xs', kind: 'dimension', description: '24px — a dense table row action.' },\n { name: 'control-height-sm', kind: 'dimension', description: '28px — the toolbar default.' },\n {\n name: 'control-height-md',\n kind: 'dimension',\n description: '32px — the form default. Button and Input are this size unless told otherwise.',\n },\n { name: 'control-height-lg', kind: 'dimension', description: '36px — a primary form action.' },\n {\n name: 'control-height-xl',\n kind: 'dimension',\n description: '40px — a hero control in an empty state.',\n },\n {\n name: 'control-padding-2xs',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 20px control.',\n },\n {\n name: 'control-padding-xs',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 24px control.',\n },\n {\n name: 'control-padding-sm',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 28px control.',\n },\n {\n name: 'control-padding-md',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 32px control.',\n },\n {\n name: 'control-padding-lg',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 36px control.',\n },\n {\n name: 'control-padding-xl',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 40px control.',\n },\n { name: 'row-height-sm', kind: 'dimension', description: '28px — a dense list row.' },\n { name: 'row-height-md', kind: 'dimension', description: '32px — the default list row.' },\n { name: 'row-height-lg', kind: 'dimension', description: '36px — a two-line list row.' },\n { name: 'rail-width', kind: 'dimension', description: '58px — the icon-only rail.' },\n { name: 'rail-width-expanded', kind: 'dimension', description: '236px — the labelled rail.' },\n {\n name: 'rail-item-height',\n kind: 'dimension',\n description: '36px — a rail or sidebar destination.',\n },\n {\n name: 'sidebar-width',\n kind: 'dimension',\n description: '256px — the secondary navigation column.',\n },\n {\n name: 'sidebar-width-compact',\n kind: 'dimension',\n description: '48px — the collapsed secondary column.',\n },\n { name: 'topbar-height', kind: 'dimension', description: '48px — the window title row.' },\n { name: 'statusbar-height', kind: 'dimension', description: '28px — the bottom readout strip.' },\n]\n\nexport const elevationTokens: TokenDefinition[] = [\n {\n name: 'shadow-2xs',\n kind: 'shadow',\n themed: true,\n description: 'Barely there: a chip resting on a card.',\n },\n {\n name: 'shadow-xs',\n kind: 'shadow',\n themed: true,\n description: 'A card or panel on the canvas.',\n },\n {\n name: 'shadow-sm',\n kind: 'shadow',\n themed: true,\n description: 'A control that lifts: a pressed toggle, a thumb.',\n },\n { name: 'shadow-md', kind: 'shadow', themed: true, description: 'A menu or popover.' },\n { name: 'shadow-lg', kind: 'shadow', themed: true, description: 'A dialog or sheet.' },\n {\n name: 'shadow-xl',\n kind: 'shadow',\n themed: true,\n description: 'The command palette, above everything.',\n },\n]\n\nexport const motionTokens: TokenDefinition[] = [\n {\n name: 'duration-fast',\n kind: 'duration',\n description: '120ms — a state change the user is already watching.',\n },\n { name: 'duration-normal', kind: 'duration', description: '200ms — an entrance.' },\n { name: 'duration-slow', kind: 'duration', description: '320ms — a layout settle.' },\n {\n name: 'ease-out',\n kind: 'easing',\n description: 'A fast start and a long settle. Reads as decisive rather than floaty.',\n },\n {\n name: 'ease-in-out',\n kind: 'easing',\n description: 'For a loop that has no start or end, such as a shimmer.',\n },\n]\n\nexport const zIndexTokens: TokenDefinition[] = [\n { name: 'z-base', kind: 'number', description: 'In flow, at the document order.' },\n {\n name: 'z-docked',\n kind: 'number',\n description: 'A sticky table header standing above its own scroll body.',\n },\n { name: 'z-sticky', kind: 'number', description: 'The top bar and any other pinned chrome.' },\n { name: 'z-drawer', kind: 'number', description: 'A drawer, below a modal dialog.' },\n { name: 'z-dialog', kind: 'number', description: 'A modal dialog and its scrim.' },\n {\n name: 'z-menu',\n kind: 'number',\n description: 'Menus, popovers and comboboxes. Above dialogs, because a dialog can contain one.',\n },\n {\n name: 'z-tooltip',\n kind: 'number',\n description: 'Tooltips. Above menus, because a menu item can carry one.',\n },\n {\n name: 'z-toast',\n kind: 'number',\n description: 'Notifications. Above everything, so they are never hidden by a dialog.',\n },\n]\n\n/**\n * The accent axis.\n *\n * adea's accent presets, as a selection rather than a constant. `theme` is the\n * default and means \"the variant's own primary\" — monochrome in adea's palette —\n * and each named preset overrides the interactive roles through the\n * `[data-accent]` blocks in `theme.css`.\n *\n * These are the same six presets `accentPresets` exports in adea's own\n * `appearance.ts`, and the values match. A consumer's appearance picker and the\n * workshop's theme toolbar read this one list, so the two cannot disagree about\n * what a preset is called or what colour it is.\n */\nexport type AccentPreset = {\n /** The `data-accent` value. `theme` is the variant's own primary. */\n id: string\n label: string\n /** What the preset is for, in the gallery and in a picker. */\n description: string\n /** The accent as it appears in the light theme. Absent for `theme`. */\n light?: string\n /** The accent as it appears in the dark theme. Absent for `theme`. */\n dark?: string\n}\n\nexport const accentPresets: readonly AccentPreset[] = Object.freeze([\n {\n id: 'theme',\n label: 'Theme',\n description:\n \"The variant's own primary. Neutral in adea's palette, so the interface stays monochrome.\",\n },\n ...ACCENTS,\n])\n\n/**\n * The font axis.\n *\n * The family is a selection, like the accent: `data-font` sits on the same element\n * and each option swaps the interface face. `space-grotesk` is the default because\n * it is the face the visual language was drawn against, and `system` is a\n * first-class option rather than a fallback — an application that wants the\n * platform's own face should be able to say so without losing the rest of the\n * system.\n */\nexport type FontOption = {\n /** The `data-font` value. `space-grotesk` is the default and needs no attribute. */\n id: string\n label: string\n description: string\n /** Which of the two stacks this option sets. */\n stack: 'sans' | 'mono' | 'both'\n}\n\nexport const fontOptions: readonly FontOption[] = Object.freeze([\n {\n id: 'space-grotesk',\n label: 'Space Grotesk',\n description: 'The default, and the face the visual language was drawn against.',\n stack: 'both',\n },\n {\n id: 'system',\n label: 'System',\n description: \"The platform's own face. What a terminal or editor usually wants.\",\n stack: 'both',\n },\n {\n id: 'geist',\n label: 'Geist',\n description: 'The face cortana already ships. Neutral and wide.',\n stack: 'both',\n },\n {\n id: 'geist-mono',\n label: 'Geist Mono',\n description: 'Monospace throughout, for someone who wants a uniform texture.',\n stack: 'both',\n },\n {\n id: 'jetbrains-mono',\n label: 'JetBrains Mono',\n description: 'Monospace throughout, with coding ligatures off.',\n stack: 'both',\n },\n])\n\n/** Every token, in gallery order. */\nexport const designTokens = {\n color: colorTokens,\n radius: radiusTokens,\n typography: typographyTokens,\n density: densityTokens,\n elevation: elevationTokens,\n motion: motionTokens,\n zIndex: zIndexTokens,\n} as const\n\n/** Flat list, for completeness checks and for search. */\nexport const allTokens: TokenDefinition[] = Object.values(designTokens).flat()\n\n/**\n * Aliases that exist only to make a call site read better, and which therefore\n * have no gallery row of their own. Kept explicit so the completeness check\n * below can tell \"deliberately absent\" from \"forgotten\".\n */\nexport const undocumentedTokenAliases: string[] = ['radius']\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAA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QAAQ"}
|
|
1
|
+
{"version":3,"file":"tokens.js","names":[],"sources":["../../src/lib/tokens.ts"],"sourcesContent":["/**\n * The design system's token manifest.\n *\n * `theme.css` is the source of truth for token *values*. This file is the\n * source of truth for token *names and meaning* — what each one is for, and\n * which ones a theme may vary.\n *\n * It exists because a manifest that is only documentation rots. Two things read\n * it instead:\n *\n * - the token galleries in Storybook, so the review surface shows every token\n * rather than the ones an author remembered;\n * - `tests/tokens.test.ts`, which parses `theme.css` and fails when a token\n * is declared in one place and missing from the other.\n *\n * That pairing is what makes \"every token is documented and every documented\n * token exists\" a property the build enforces rather than a promise.\n */\n\nimport { ACCENTS } from '@adea-ai/themes'\n\nexport type TokenKind =\n | 'color'\n | 'dimension'\n | 'font-family'\n | 'number'\n | 'duration'\n | 'easing'\n | 'shadow'\n | 'text'\n\nexport type TokenDefinition = {\n /** The custom property name, without the leading `--`. */\n name: string\n kind: TokenKind\n /** One line: what this token is for. Shown in the gallery. */\n description: string\n /** True when the light and dark themes give it different values. */\n themed?: boolean\n}\n\n/**\n * Colour roles, in the order they appear in a page: surfaces first, then text,\n * then the lines between them, then the semantic fills. The order is the\n * documentation — reading the gallery top to bottom walks the surface ladder.\n */\nexport const colorTokens: TokenDefinition[] = [\n // Surfaces\n {\n name: 'background',\n kind: 'color',\n themed: true,\n description: 'The canvas every panel sits on.',\n },\n {\n name: 'foreground',\n kind: 'color',\n themed: true,\n description: 'Default body text on the canvas.',\n },\n {\n name: 'card',\n kind: 'color',\n themed: true,\n description: 'A panel or card raised one rung above the canvas.',\n },\n { name: 'card-foreground', kind: 'color', themed: true, description: 'Text on `card`.' },\n {\n name: 'popover',\n kind: 'color',\n themed: true,\n description: 'A floating surface: dialog, menu, popover, tooltip-free.',\n },\n { name: 'popover-foreground', kind: 'color', themed: true, description: 'Text on `popover`.' },\n {\n name: 'surface',\n kind: 'color',\n themed: true,\n description: 'Alias of `background`, for code that means \"a surface\" not \"the page\".',\n },\n {\n name: 'surface-sunken',\n kind: 'color',\n themed: true,\n description: 'A well: code blocks, inset lists, empty states.',\n },\n {\n name: 'surface-raised',\n kind: 'color',\n themed: true,\n description: 'Alias of `card`, for panels that sit on the canvas.',\n },\n {\n name: 'surface-overlay',\n kind: 'color',\n themed: true,\n description: 'Alias of `popover`, for floating layers.',\n },\n {\n name: 'surface-hover',\n kind: 'color',\n themed: true,\n description: 'The hover fill shared by rows, menu items and ghost controls.',\n },\n {\n name: 'surface-active',\n kind: 'color',\n themed: true,\n description: 'The pressed/selected fill, one rung past hover.',\n },\n {\n name: 'chrome',\n kind: 'color',\n themed: true,\n description: 'Window chrome: the top bar and its frosted fill.',\n },\n {\n name: 'chrome-alpha',\n kind: 'number',\n themed: true,\n description: 'Opacity of the chrome fill behind a blur.',\n },\n\n // The brand action\n {\n name: 'primary',\n kind: 'color',\n themed: true,\n description: 'The Adea emerald. The one primary action in a view.',\n },\n {\n name: 'primary-foreground',\n kind: 'color',\n themed: true,\n description: 'Label on `primary`. Black in dark, white in light — the accent flips polarity.',\n },\n {\n name: 'primary-hover',\n kind: 'color',\n themed: true,\n description: 'Hover rung for a primary action.',\n },\n {\n name: 'primary-subtle',\n kind: 'color',\n themed: true,\n description: 'Tinted primary fill: selected rows, focus rings, subtle buttons.',\n },\n\n {\n name: 'secondary',\n kind: 'color',\n themed: true,\n description: 'A quieter filled surface for a secondary action.',\n },\n {\n name: 'secondary-foreground',\n kind: 'color',\n themed: true,\n description: 'Label on `secondary`.',\n },\n {\n name: 'muted',\n kind: 'color',\n themed: true,\n description: 'A neutral fill: skeletons, inert chips, table footers.',\n },\n {\n name: 'muted-foreground',\n kind: 'color',\n themed: true,\n description: 'De-emphasised text. Measured to clear 4.5:1 on both `background` and `card`.',\n },\n {\n name: 'accent',\n kind: 'color',\n themed: true,\n description: \"shadcn's hover-surface accent. Not the brand colour — that is `primary`.\",\n },\n { name: 'accent-foreground', kind: 'color', themed: true, description: 'Text on `accent`.' },\n\n // Status\n {\n name: 'destructive',\n kind: 'color',\n themed: true,\n description: 'The canonical error hue for semantic status indicators and tinted notices.',\n },\n {\n name: 'destructive-foreground',\n kind: 'color',\n themed: true,\n description:\n 'Text on the canonical error hue; solid actions use `destructive-action-foreground`.',\n },\n {\n name: 'destructive-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque destructive tint against the canvas; subtle labels use foreground.',\n },\n {\n name: 'destructive-action',\n kind: 'color',\n themed: true,\n description: 'Contrast-safe solid fill for destructive actions, derived from the error role.',\n },\n {\n name: 'destructive-action-foreground',\n kind: 'color',\n themed: true,\n description: 'Text on the destructive action fill and its 90% hover composition.',\n },\n { name: 'success', kind: 'color', themed: true, description: 'A completed or healthy state.' },\n { name: 'success-foreground', kind: 'color', themed: true, description: 'Label on `success`.' },\n {\n name: 'success-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque success tint against the canvas; subtle labels use foreground.',\n },\n {\n name: 'warning',\n kind: 'color',\n themed: true,\n description: 'Something needs attention but is not broken.',\n },\n { name: 'warning-foreground', kind: 'color', themed: true, description: 'Label on `warning`.' },\n {\n name: 'warning-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque warning tint against the canvas; subtle labels use foreground.',\n },\n { name: 'info', kind: 'color', themed: true, description: 'Neutral information.' },\n { name: 'info-foreground', kind: 'color', themed: true, description: 'Label on `info`.' },\n {\n name: 'info-subtle',\n kind: 'color',\n themed: true,\n description: 'Opaque info tint against the canvas; subtle labels use foreground.',\n },\n\n // Lines\n {\n name: 'border',\n kind: 'color',\n themed: true,\n description: 'Every hairline: panel edges, dividers, card outlines.',\n },\n {\n name: 'input',\n kind: 'color',\n themed: true,\n description:\n 'The edge of an editable control. A rung stronger than `border` so a field is findable.',\n },\n {\n name: 'ring',\n kind: 'color',\n themed: true,\n description: 'The focus ring. Always paired with `primary-subtle` as its glow.',\n },\n\n // Theme-invariant glass\n {\n name: 'scrim',\n kind: 'color',\n description: 'Dark glass for overlays and on-screen controls. Same in both themes.',\n },\n { name: 'scrim-foreground', kind: 'color', description: 'Text drawn on `scrim`.' },\n { name: 'scrim-edge', kind: 'color', description: 'The hairline drawn on `scrim`.' },\n\n // Diff and code\n { name: 'diff-add', kind: 'color', themed: true, description: 'Background of an added line.' },\n {\n name: 'diff-add-foreground',\n kind: 'color',\n themed: true,\n description: 'Text of an added line.',\n },\n {\n name: 'diff-delete',\n kind: 'color',\n themed: true,\n description: 'Background of a removed line.',\n },\n {\n name: 'diff-delete-foreground',\n kind: 'color',\n themed: true,\n description: 'Text of a removed line.',\n },\n { name: 'diff-hunk', kind: 'color', themed: true, description: 'Background of a hunk header.' },\n {\n name: 'diff-hunk-foreground',\n kind: 'color',\n themed: true,\n description: 'Text of a hunk header.',\n },\n {\n name: 'diff-meta-foreground',\n kind: 'color',\n themed: true,\n description: 'File headers and line numbers in a diff.',\n },\n\n // Charts\n {\n name: 'chart-1',\n kind: 'color',\n themed: true,\n description: 'Categorical series 1. The set is closed at six.',\n },\n { name: 'chart-2', kind: 'color', themed: true, description: 'Categorical series 2.' },\n { name: 'chart-3', kind: 'color', themed: true, description: 'Categorical series 3.' },\n { name: 'chart-4', kind: 'color', themed: true, description: 'Categorical series 4.' },\n { name: 'chart-5', kind: 'color', themed: true, description: 'Categorical series 5.' },\n { name: 'chart-6', kind: 'color', themed: true, description: 'Categorical series 6.' },\n\n // Sidebar (the shadcn contract, kept whole)\n {\n name: 'sidebar',\n kind: 'color',\n themed: true,\n description: 'The rail and sidebar surface, tinted against the canvas.',\n },\n {\n name: 'sidebar-foreground',\n kind: 'color',\n themed: true,\n description: 'Default text in the rail and sidebar.',\n },\n {\n name: 'sidebar-primary',\n kind: 'color',\n themed: true,\n description: 'The active destination in the rail.',\n },\n {\n name: 'sidebar-primary-foreground',\n kind: 'color',\n themed: true,\n description: 'Text on the active rail destination.',\n },\n {\n name: 'sidebar-accent',\n kind: 'color',\n themed: true,\n description: 'Hover and selected fill for rail and sidebar rows.',\n },\n {\n name: 'sidebar-accent-foreground',\n kind: 'color',\n themed: true,\n description: 'Text on `sidebar-accent`.',\n },\n {\n name: 'sidebar-border',\n kind: 'color',\n themed: true,\n description: 'The rule between the rail and the canvas.',\n },\n { name: 'sidebar-ring', kind: 'color', themed: true, description: 'Focus ring inside the rail.' },\n {\n name: 'sidebar-muted-foreground',\n kind: 'color',\n themed: true,\n description: 'Rail labels that are not the current destination.',\n },\n]\n\nexport const radiusTokens: TokenDefinition[] = [\n {\n name: 'radius-lg',\n kind: 'dimension',\n description:\n '10px — cards and panels. Also the knob: move this one value to re-round the whole system.',\n },\n { name: 'radius-sm', kind: 'dimension', description: '6px — badges, keyboard keys, menu items.' },\n {\n name: 'radius-md',\n kind: 'dimension',\n description: '8px — every control: buttons, inputs, selects.',\n },\n { name: 'radius-xl', kind: 'dimension', description: '14px — dialogs, menus, sheets.' },\n { name: 'radius-2xl', kind: 'dimension', description: '18px — full-window surfaces and media.' },\n]\n\nexport const typographyTokens: TokenDefinition[] = [\n {\n name: 'font-sans',\n kind: 'font-family',\n description: 'The selected interface face. Space Grotesk unless the font axis says otherwise.',\n },\n {\n name: 'font-mono',\n kind: 'font-family',\n description: 'The selected monospace face. Code, terminals, ids, paths.',\n },\n {\n name: 'font-family-space-grotesk',\n kind: 'font-family',\n description: 'The interface default, and the face the visual language was drawn against.',\n },\n {\n name: 'font-family-jetbrains-mono',\n kind: 'font-family',\n description: 'The monospace default. Code, terminals, diffs.',\n },\n {\n name: 'font-family-geist',\n kind: 'font-family',\n description: 'An alternative interface face. cortana already ships it.',\n },\n {\n name: 'font-family-geist-mono',\n kind: 'font-family',\n description: 'The monospace counterpart to Geist.',\n },\n {\n name: 'font-family-system',\n kind: 'font-family',\n description: \"The platform's own interface face. First-class, not a fallback.\",\n },\n {\n name: 'font-family-system-mono',\n kind: 'font-family',\n description: \"The platform's own monospace face.\",\n },\n {\n name: 'ui-tracking',\n kind: 'text',\n description:\n 'Letter spacing for measured chrome. `normal` on a proportional face, tightened when the UI font is monospace — which is roughly 20% wider at the same size.',\n },\n {\n name: 'ui-word-spacing',\n kind: 'text',\n description:\n \"Word spacing for measured chrome. Mono's space is a full advance-width cell, so a two-word label reads as two floating words without this.\",\n },\n {\n name: 'text-2xs',\n kind: 'text',\n description: '11px — the smallest label the system permits: kbd keys, status bar.',\n },\n { name: 'text-xs', kind: 'text', description: '12px — metadata, badges, secondary rows.' },\n {\n name: 'text-sm',\n kind: 'text',\n description: '14px — the interface default. Body copy, labels, controls.',\n },\n { name: 'text-base', kind: 'text', description: '16px — card titles and dialog titles.' },\n { name: 'text-lg', kind: 'text', description: '18px — a section heading inside a page.' },\n { name: 'text-xl', kind: 'text', description: '20px — a page title.' },\n { name: 'text-2xl', kind: 'text', description: '24px — a display figure.' },\n {\n name: 'text-3xl',\n kind: 'text',\n description: '30px — the largest size in the system. Reserved for an empty-state headline.',\n },\n]\n\n/** Height tokens also size both axes of icon controls through Tailwind's --size\n * namespace. Padding has its own --spacing mapping. Nominal pixel descriptions\n * use a 16px rem; rendered dimensions follow the consumer's root font size. */\nexport const densityTokens: TokenDefinition[] = [\n { name: 'control-height-2xs', kind: 'dimension', description: '20px — an inline chip control.' },\n { name: 'control-height-xs', kind: 'dimension', description: '24px — a dense table row action.' },\n { name: 'control-height-sm', kind: 'dimension', description: '28px — the toolbar default.' },\n {\n name: 'control-height-md',\n kind: 'dimension',\n description: '32px — the form default. Button and Input are this size unless told otherwise.',\n },\n { name: 'control-height-lg', kind: 'dimension', description: '36px — a primary form action.' },\n {\n name: 'control-height-xl',\n kind: 'dimension',\n description: '40px — a hero control in an empty state.',\n },\n {\n name: 'control-padding-2xs',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 20px control.',\n },\n {\n name: 'control-padding-xs',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 24px control.',\n },\n {\n name: 'control-padding-sm',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 28px control.',\n },\n {\n name: 'control-padding-md',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 32px control.',\n },\n {\n name: 'control-padding-lg',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 36px control.',\n },\n {\n name: 'control-padding-xl',\n kind: 'dimension',\n description: 'Inline padding that pairs with the 40px control.',\n },\n { name: 'row-height-sm', kind: 'dimension', description: '28px — a dense list row.' },\n { name: 'row-height-md', kind: 'dimension', description: '32px — the default list row.' },\n { name: 'row-height-lg', kind: 'dimension', description: '36px — a two-line list row.' },\n { name: 'rail-width', kind: 'dimension', description: '58px — the icon-only rail.' },\n { name: 'rail-width-expanded', kind: 'dimension', description: '236px — the labelled rail.' },\n {\n name: 'rail-item-height',\n kind: 'dimension',\n description: '36px — a rail or sidebar destination.',\n },\n {\n name: 'sidebar-width',\n kind: 'dimension',\n description: '256px — the secondary navigation column.',\n },\n {\n name: 'sidebar-width-compact',\n kind: 'dimension',\n description: '48px — the collapsed secondary column.',\n },\n { name: 'topbar-height', kind: 'dimension', description: '48px — the window title row.' },\n { name: 'statusbar-height', kind: 'dimension', description: '28px — the bottom readout strip.' },\n]\n\nexport const elevationTokens: TokenDefinition[] = [\n {\n name: 'shadow-2xs',\n kind: 'shadow',\n themed: true,\n description: 'Barely there: a chip resting on a card.',\n },\n {\n name: 'shadow-xs',\n kind: 'shadow',\n themed: true,\n description: 'A card or panel on the canvas.',\n },\n {\n name: 'shadow-sm',\n kind: 'shadow',\n themed: true,\n description: 'A control that lifts: a pressed toggle, a thumb.',\n },\n { name: 'shadow-md', kind: 'shadow', themed: true, description: 'A menu or popover.' },\n { name: 'shadow-lg', kind: 'shadow', themed: true, description: 'A dialog or sheet.' },\n {\n name: 'shadow-xl',\n kind: 'shadow',\n themed: true,\n description: 'The command palette, above everything.',\n },\n]\n\nexport const motionTokens: TokenDefinition[] = [\n {\n name: 'duration-fast',\n kind: 'duration',\n description: '120ms — a state change the user is already watching.',\n },\n { name: 'duration-normal', kind: 'duration', description: '200ms — an entrance.' },\n { name: 'duration-slow', kind: 'duration', description: '320ms — a layout settle.' },\n {\n name: 'ease-out',\n kind: 'easing',\n description: 'A fast start and a long settle. Reads as decisive rather than floaty.',\n },\n {\n name: 'ease-in-out',\n kind: 'easing',\n description: 'For a loop that has no start or end, such as a shimmer.',\n },\n]\n\nexport const zIndexTokens: TokenDefinition[] = [\n { name: 'z-base', kind: 'number', description: 'In flow, at the document order.' },\n {\n name: 'z-docked',\n kind: 'number',\n description: 'A sticky table header standing above its own scroll body.',\n },\n { name: 'z-sticky', kind: 'number', description: 'The top bar and any other pinned chrome.' },\n { name: 'z-drawer', kind: 'number', description: 'A drawer, below a modal dialog.' },\n { name: 'z-dialog', kind: 'number', description: 'A modal dialog and its scrim.' },\n {\n name: 'z-menu',\n kind: 'number',\n description: 'Menus, popovers and comboboxes. Above dialogs, because a dialog can contain one.',\n },\n {\n name: 'z-tooltip',\n kind: 'number',\n description: 'Tooltips. Above menus, because a menu item can carry one.',\n },\n {\n name: 'z-toast',\n kind: 'number',\n description: 'Notifications. Above everything, so they are never hidden by a dialog.',\n },\n]\n\n/**\n * The accent axis.\n *\n * adea's accent presets, as a selection rather than a constant. `theme` is the\n * default and means \"the variant's own primary\" — monochrome in adea's palette —\n * and each named preset overrides the interactive roles through the\n * `[data-accent]` blocks in `theme.css`.\n *\n * These are the same six presets `accentPresets` exports in adea's own\n * `appearance.ts`, and the values match. A consumer's appearance picker and the\n * workshop's theme toolbar read this one list, so the two cannot disagree about\n * what a preset is called or what colour it is.\n */\nexport type AccentPreset = {\n /** The `data-accent` value. `theme` is the variant's own primary. */\n id: string\n label: string\n /** What the preset is for, in the gallery and in a picker. */\n description: string\n /** The accent as it appears in the light theme. Absent for `theme`. */\n light?: string\n /** The accent as it appears in the dark theme. Absent for `theme`. */\n dark?: string\n}\n\nexport const accentPresets: readonly AccentPreset[] = Object.freeze([\n {\n id: 'theme',\n label: 'Theme',\n description:\n \"The variant's own primary. Neutral in adea's palette, so the interface stays monochrome.\",\n },\n ...ACCENTS,\n])\n\n/**\n * The font axis.\n *\n * The family is a selection, like the accent: `data-font` sits on the same element\n * and each option swaps the interface face. `space-grotesk` is the default because\n * it is the face the visual language was drawn against, and `system` is a\n * first-class option rather than a fallback — an application that wants the\n * platform's own face should be able to say so without losing the rest of the\n * system.\n */\nexport type FontOption = {\n /** The `data-font` value. `space-grotesk` is the default and needs no attribute. */\n id: string\n label: string\n description: string\n /** Which of the two stacks this option sets. */\n stack: 'sans' | 'mono' | 'both'\n}\n\nexport const fontOptions: readonly FontOption[] = Object.freeze([\n {\n id: 'space-grotesk',\n label: 'Space Grotesk',\n description: 'The default, and the face the visual language was drawn against.',\n stack: 'both',\n },\n {\n id: 'system',\n label: 'System',\n description: \"The platform's own face. What a terminal or editor usually wants.\",\n stack: 'both',\n },\n {\n id: 'geist',\n label: 'Geist',\n description: 'The face cortana already ships. Neutral and wide.',\n stack: 'both',\n },\n {\n id: 'geist-mono',\n label: 'Geist Mono',\n description: 'Monospace throughout, for someone who wants a uniform texture.',\n stack: 'both',\n },\n {\n id: 'jetbrains-mono',\n label: 'JetBrains Mono',\n description: 'Monospace throughout, with coding ligatures off.',\n stack: 'both',\n },\n])\n\n/** Every token, in gallery order. */\nexport const designTokens = {\n color: colorTokens,\n radius: radiusTokens,\n typography: typographyTokens,\n density: densityTokens,\n elevation: elevationTokens,\n motion: motionTokens,\n zIndex: zIndexTokens,\n} as const\n\n/** Flat list, for completeness checks and for search. */\nexport const allTokens: TokenDefinition[] = Object.values(designTokens).flat()\n\n/**\n * Aliases that exist only to make a call site read better, and which therefore\n * have no gallery row of their own. Kept explicit so the completeness check\n * below can tell \"deliberately absent\" from \"forgotten\".\n */\nexport const undocumentedTokenAliases: string[] = ['radius']\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA8CA,IAAa,cAAiC;CAE5C;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,aAAa;CACf;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,aAAa;CACf;CACA;EACE,MAAM;EACN,MAAM;EACN,QAAQ;EACR,aAAa;CACf;CACA;EAAE,MAAM;EAAmB,MAAM;EAA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M;EAAiB,MAAM;EAAY,aAAa;CAA2B;CACnF;EACE,MAAM;EACN,MAAM;EACN,aAAa;CACf;CACA;EACE,MAAM;EACN,MAAM;EACN,aAAa;CACf;AACF;AAEA,IAAa,eAAkC;CAC7C;EAAE,MAAM;EAAU,MAAM;EAAU,aAAa;CAAkC;CACjF;EACE,MAAM;EACN,MAAM;EACN,aAAa;CACf;CACA;EAAE,MAAM;EAAY,MAAM;EAAU,aAAa;CAA2C;CAC5F;EAAE,MAAM;EAAY,MAAM;EAAU,aAAa;CAAkC;CACnF;EAAE,MAAM;EAAY,MAAM;EAAU,aAAa;CAAgC;CACjF;EACE,MAAM;EACN,MAAM;EACN,aAAa;CACf;CACA;EACE,MAAM;EACN,MAAM;EACN,aAAa;CACf;CACA;EACE,MAAM;EACN,MAAM;EACN,aAAa;CACf;AACF;AA2BA,IAAa,gBAAyC,OAAO,OAAO,CAClE;CACE,IAAI;CACJ,OAAO;CACP,aACE;AACJ,GACA,GAAG,OACL,CAAC;AAqBD,IAAa,cAAqC,OAAO,OAAO;CAC9D;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,OAAO;CACT;CACA;EACE,IAAI;EACJ,OAAO;EACP,aAAa;EACb,OAAO;CACT;AACF,CAAC;;AAGD,IAAa,eAAe;CAC1B,OAAO;CACP,QAAQ;CACR,YAAY;CACZ,SAAS;CACT,WAAW;CACX,QAAQ;CACR,QAAQ;AACV;;AAGA,IAAa,YAA+B,OAAO,OAAO,YAAY,CAAC,CAAC,KAAK;;;;;;AAO7E,IAAa,2BAAqC,CAAC,QAAQ"}
|
package/dist/r/lib.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"title": "Class-name and token helpers",
|
|
5
5
|
"description": "The private helpers the components import: the class-name merge, the variant recipes, the token manifest and the theme bridge. Installed automatically as a peer of any component that needs it.",
|
|
6
6
|
"dependencies": [
|
|
7
|
-
"@adea-ai/themes@^0.6.
|
|
7
|
+
"@adea-ai/themes@^0.6.2",
|
|
8
8
|
"class-variance-authority@^0.7.1",
|
|
9
9
|
"clsx@^2.1.1",
|
|
10
10
|
"tailwind-merge@^3.7.0"
|
package/dist/r/registry.json
CHANGED
|
@@ -1670,7 +1670,7 @@
|
|
|
1670
1670
|
"title": "Appearance Editor",
|
|
1671
1671
|
"description": "",
|
|
1672
1672
|
"dependencies": [
|
|
1673
|
-
"@adea-ai/themes@^0.6.
|
|
1673
|
+
"@adea-ai/themes@^0.6.2",
|
|
1674
1674
|
"@kobalte/core@^0.13.14",
|
|
1675
1675
|
"lucide-solid@^1.48.0"
|
|
1676
1676
|
],
|
|
@@ -2064,7 +2064,7 @@
|
|
|
2064
2064
|
"title": "Class-name and token helpers",
|
|
2065
2065
|
"description": "The private helpers the components import: the class-name merge, the variant recipes, the token manifest and the theme bridge. Installed automatically as a peer of any component that needs it.",
|
|
2066
2066
|
"dependencies": [
|
|
2067
|
-
"@adea-ai/themes@^0.6.
|
|
2067
|
+
"@adea-ai/themes@^0.6.2",
|
|
2068
2068
|
"class-variance-authority@^0.7.1",
|
|
2069
2069
|
"clsx@^2.1.1",
|
|
2070
2070
|
"tailwind-merge@^3.7.0"
|
|
@@ -47,7 +47,7 @@ export function ThemeSwatch(props: ThemeSwatchProps) {
|
|
|
47
47
|
colors().card,
|
|
48
48
|
colors().primary,
|
|
49
49
|
colors().accent,
|
|
50
|
-
colors().
|
|
50
|
+
colors().destructiveAction,
|
|
51
51
|
]}
|
|
52
52
|
>
|
|
53
53
|
{(color) => (
|
|
@@ -109,7 +109,10 @@ export function ThemePreview(props: ThemePreviewProps) {
|
|
|
109
109
|
<div class="h-1 w-16 rounded-full" style={{ 'background-color': c().mutedForeground }} />
|
|
110
110
|
<div class="mt-auto flex items-center gap-1">
|
|
111
111
|
<span class="h-3 w-9 rounded-sm" style={{ 'background-color': c().primary }} />
|
|
112
|
-
<span
|
|
112
|
+
<span
|
|
113
|
+
class="h-3 w-6 rounded-sm"
|
|
114
|
+
style={{ 'background-color': c().destructiveAction }}
|
|
115
|
+
/>
|
|
113
116
|
<span class="h-3 w-6 rounded-sm" style={{ 'background-color': c().secondary }} />
|
|
114
117
|
</div>
|
|
115
118
|
</div>
|
|
@@ -29,7 +29,7 @@ export const buttonVariants = cva(
|
|
|
29
29
|
secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',
|
|
30
30
|
/** For the action that destroys something. Never the default. */
|
|
31
31
|
destructive:
|
|
32
|
-
'bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive-subtle',
|
|
32
|
+
'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',
|
|
33
33
|
/** A bordered button for a surface that already has a fill. */
|
|
34
34
|
outline:
|
|
35
35
|
'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',
|
|
@@ -262,7 +262,12 @@ export function DialogContent(props: DialogContentProps) {
|
|
|
262
262
|
<DialogOverlay />
|
|
263
263
|
<div class={overlayPositioner}>
|
|
264
264
|
<KobalteDialog.Content
|
|
265
|
-
class={cn(
|
|
265
|
+
class={cn(
|
|
266
|
+
overlaySurface,
|
|
267
|
+
overlayMotion,
|
|
268
|
+
'relative grid w-full max-w-lg gap-4 p-5',
|
|
269
|
+
local.class
|
|
270
|
+
)}
|
|
266
271
|
{...rest}
|
|
267
272
|
>
|
|
268
273
|
{local.children}
|
package/dist/r/src/lib/themes.ts
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
chartSeries,
|
|
40
40
|
getAccent,
|
|
41
41
|
hasTheme,
|
|
42
|
+
shadcnDestructiveProjection,
|
|
42
43
|
statusForeground,
|
|
43
44
|
tint,
|
|
44
45
|
primaryHover,
|
|
@@ -78,6 +79,9 @@ export type ThemeColors = {
|
|
|
78
79
|
destructive: string
|
|
79
80
|
destructiveForeground: string
|
|
80
81
|
destructiveSubtle: string
|
|
82
|
+
/** Contrast-safe solid-action presentation, derived from the canonical error role. */
|
|
83
|
+
destructiveAction: string
|
|
84
|
+
destructiveActionForeground: string
|
|
81
85
|
success: string
|
|
82
86
|
successForeground: string
|
|
83
87
|
successSubtle: string
|
|
@@ -170,10 +174,12 @@ export type ThemeVariant = {
|
|
|
170
174
|
/**
|
|
171
175
|
* Canonical role → this system's `ThemeColors` key.
|
|
172
176
|
*
|
|
173
|
-
* Read by {@link toVariant}.
|
|
174
|
-
*
|
|
177
|
+
* Read by {@link toVariant}. The two derived destructive-action presentation values
|
|
178
|
+
* are intentionally excluded; the shared Themes adapter owns their color math.
|
|
175
179
|
*/
|
|
176
|
-
|
|
180
|
+
type ThemeRole = Exclude<keyof ThemeColors, 'destructiveAction' | 'destructiveActionForeground'>
|
|
181
|
+
|
|
182
|
+
const ROLE_FOR: Readonly<Record<ThemeRole, keyof AdeaThemeRecord['colors']>> = {
|
|
177
183
|
background: 'background',
|
|
178
184
|
foreground: 'text',
|
|
179
185
|
card: 'surface',
|
|
@@ -216,14 +222,17 @@ const ROLE_FOR: Readonly<Record<keyof ThemeColors, keyof AdeaThemeRecord['colors
|
|
|
216
222
|
/** Builds the design system's view of one catalogue entry. */
|
|
217
223
|
function toVariant(theme: AdeaThemeRecord): ThemeVariant {
|
|
218
224
|
const colors = {} as ThemeColors
|
|
219
|
-
for (const key of Object.keys(ROLE_FOR) as
|
|
225
|
+
for (const key of Object.keys(ROLE_FOR) as ThemeRole[]) {
|
|
220
226
|
colors[key] = theme.colors[ROLE_FOR[key]]
|
|
221
227
|
}
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
228
|
+
// Keep the semantic foreground paired with the canonical error role. Filled
|
|
229
|
+
// destructive actions use the distinct projection below so their /90 hover state
|
|
230
|
+
// remains readable without changing icons, borders, or tinted status surfaces.
|
|
225
231
|
colors.destructiveForeground = statusForeground(theme, 'error')
|
|
226
232
|
colors.destructiveSubtle = tint(theme.colors.error, theme.colors.background)
|
|
233
|
+
const destructiveAction = shadcnDestructiveProjection(theme)
|
|
234
|
+
colors.destructiveAction = destructiveAction.fill
|
|
235
|
+
colors.destructiveActionForeground = destructiveAction.foreground
|
|
227
236
|
colors.successForeground = statusForeground(theme, 'success')
|
|
228
237
|
colors.successSubtle = tint(theme.colors.success, theme.colors.background)
|
|
229
238
|
colors.warningForeground = statusForeground(theme, 'warning')
|
|
@@ -397,6 +406,8 @@ export function themeCssVariables(theme: ThemeVariant): Record<string, string> {
|
|
|
397
406
|
'--destructive': c.destructive,
|
|
398
407
|
'--destructive-foreground': c.destructiveForeground,
|
|
399
408
|
'--destructive-subtle': c.destructiveSubtle,
|
|
409
|
+
'--destructive-action': c.destructiveAction,
|
|
410
|
+
'--destructive-action-foreground': c.destructiveActionForeground,
|
|
400
411
|
'--success': c.success,
|
|
401
412
|
'--success-foreground': c.successForeground,
|
|
402
413
|
'--success-subtle': c.successSubtle,
|
package/dist/r/src/lib/tokens.ts
CHANGED
|
@@ -184,13 +184,14 @@ export const colorTokens: TokenDefinition[] = [
|
|
|
184
184
|
name: 'destructive',
|
|
185
185
|
kind: 'color',
|
|
186
186
|
themed: true,
|
|
187
|
-
description: '
|
|
187
|
+
description: 'The canonical error hue for semantic status indicators and tinted notices.',
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
name: 'destructive-foreground',
|
|
191
191
|
kind: 'color',
|
|
192
192
|
themed: true,
|
|
193
|
-
description:
|
|
193
|
+
description:
|
|
194
|
+
'Text on the canonical error hue; solid actions use `destructive-action-foreground`.',
|
|
194
195
|
},
|
|
195
196
|
{
|
|
196
197
|
name: 'destructive-subtle',
|
|
@@ -198,6 +199,18 @@ export const colorTokens: TokenDefinition[] = [
|
|
|
198
199
|
themed: true,
|
|
199
200
|
description: 'Opaque destructive tint against the canvas; subtle labels use foreground.',
|
|
200
201
|
},
|
|
202
|
+
{
|
|
203
|
+
name: 'destructive-action',
|
|
204
|
+
kind: 'color',
|
|
205
|
+
themed: true,
|
|
206
|
+
description: 'Contrast-safe solid fill for destructive actions, derived from the error role.',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'destructive-action-foreground',
|
|
210
|
+
kind: 'color',
|
|
211
|
+
themed: true,
|
|
212
|
+
description: 'Text on the destructive action fill and its 90% hover composition.',
|
|
213
|
+
},
|
|
201
214
|
{ name: 'success', kind: 'color', themed: true, description: 'A completed or healthy state.' },
|
|
202
215
|
{ name: 'success-foreground', kind: 'color', themed: true, description: 'Label on `success`.' },
|
|
203
216
|
{
|
|
@@ -81,6 +81,8 @@
|
|
|
81
81
|
/* Status fills; solid labels and subtle surfaces come from the catalogue. */
|
|
82
82
|
--destructive: oklch(0.4705 0.1626 25.78);
|
|
83
83
|
--destructive-foreground: oklch(0.933 0.016 261.79);
|
|
84
|
+
--destructive-action: oklch(0.4705 0.1626 25.78);
|
|
85
|
+
--destructive-action-foreground: oklch(0.933 0.016 261.79);
|
|
84
86
|
--success: oklch(0.4311 0.1809 145.62);
|
|
85
87
|
--success-foreground: oklch(0.933 0.016 261.79);
|
|
86
88
|
--warning: oklch(0.4556 0.1401 79.91);
|
|
@@ -216,6 +218,8 @@
|
|
|
216
218
|
/* Status fills; solid labels and subtle surfaces come from the catalogue. */
|
|
217
219
|
--destructive: oklch(0.7345 0.1626 25.78);
|
|
218
220
|
--destructive-foreground: oklch(0.1918 0.0238 265.37);
|
|
221
|
+
--destructive-action: oklch(0.7345 0.1626 25.78);
|
|
222
|
+
--destructive-action-foreground: oklch(0.1918 0.0238 265.37);
|
|
219
223
|
--success: oklch(0.6951 0.1809 145.62);
|
|
220
224
|
--success-foreground: oklch(0.1918 0.0238 265.37);
|
|
221
225
|
--warning: oklch(0.7196 0.1401 79.91);
|
|
@@ -730,6 +734,8 @@
|
|
|
730
734
|
--color-destructive: var(--destructive);
|
|
731
735
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
732
736
|
--color-destructive-subtle: var(--destructive-subtle);
|
|
737
|
+
--color-destructive-action: var(--destructive-action);
|
|
738
|
+
--color-destructive-action-foreground: var(--destructive-action-foreground);
|
|
733
739
|
--color-success: var(--success);
|
|
734
740
|
--color-success-foreground: var(--success-foreground);
|
|
735
741
|
--color-success-subtle: var(--success-subtle);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.72.0",
|
|
4
4
|
"description": "The Adea design system: Kobalte-backed Solid components, semantic OKLCH tokens, and the app-shell layout primitives shared by Adea and Cortana.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"adea",
|
|
@@ -106,7 +106,7 @@
|
|
|
106
106
|
"check:packed-paste-model": "node scripts/check-packed-paste-model.mjs"
|
|
107
107
|
},
|
|
108
108
|
"dependencies": {
|
|
109
|
-
"@adea-ai/themes": "^0.6.
|
|
109
|
+
"@adea-ai/themes": "^0.6.2",
|
|
110
110
|
"@corvu/calendar": "^0.1.2",
|
|
111
111
|
"@corvu/drawer": "^0.2.4",
|
|
112
112
|
"@corvu/otp-field": "^0.1.4",
|
package/registry.json
CHANGED
|
@@ -1670,7 +1670,7 @@
|
|
|
1670
1670
|
"title": "Appearance Editor",
|
|
1671
1671
|
"description": "",
|
|
1672
1672
|
"dependencies": [
|
|
1673
|
-
"@adea-ai/themes@^0.6.
|
|
1673
|
+
"@adea-ai/themes@^0.6.2",
|
|
1674
1674
|
"@kobalte/core@^0.13.14",
|
|
1675
1675
|
"lucide-solid@^1.48.0"
|
|
1676
1676
|
],
|
|
@@ -2064,7 +2064,7 @@
|
|
|
2064
2064
|
"title": "Class-name and token helpers",
|
|
2065
2065
|
"description": "The private helpers the components import: the class-name merge, the variant recipes, the token manifest and the theme bridge. Installed automatically as a peer of any component that needs it.",
|
|
2066
2066
|
"dependencies": [
|
|
2067
|
-
"@adea-ai/themes@^0.6.
|
|
2067
|
+
"@adea-ai/themes@^0.6.2",
|
|
2068
2068
|
"class-variance-authority@^0.7.1",
|
|
2069
2069
|
"clsx@^2.1.1",
|
|
2070
2070
|
"tailwind-merge@^3.7.0"
|
|
@@ -47,7 +47,7 @@ export function ThemeSwatch(props: ThemeSwatchProps) {
|
|
|
47
47
|
colors().card,
|
|
48
48
|
colors().primary,
|
|
49
49
|
colors().accent,
|
|
50
|
-
colors().
|
|
50
|
+
colors().destructiveAction,
|
|
51
51
|
]}
|
|
52
52
|
>
|
|
53
53
|
{(color) => (
|
|
@@ -109,7 +109,10 @@ export function ThemePreview(props: ThemePreviewProps) {
|
|
|
109
109
|
<div class="h-1 w-16 rounded-full" style={{ 'background-color': c().mutedForeground }} />
|
|
110
110
|
<div class="mt-auto flex items-center gap-1">
|
|
111
111
|
<span class="h-3 w-9 rounded-sm" style={{ 'background-color': c().primary }} />
|
|
112
|
-
<span
|
|
112
|
+
<span
|
|
113
|
+
class="h-3 w-6 rounded-sm"
|
|
114
|
+
style={{ 'background-color': c().destructiveAction }}
|
|
115
|
+
/>
|
|
113
116
|
<span class="h-3 w-6 rounded-sm" style={{ 'background-color': c().secondary }} />
|
|
114
117
|
</div>
|
|
115
118
|
</div>
|
|
@@ -29,7 +29,7 @@ export const buttonVariants = cva(
|
|
|
29
29
|
secondary: 'bg-secondary text-secondary-foreground hover:bg-surface-hover',
|
|
30
30
|
/** For the action that destroys something. Never the default. */
|
|
31
31
|
destructive:
|
|
32
|
-
'bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive-subtle',
|
|
32
|
+
'bg-destructive-action text-destructive-action-foreground hover:bg-destructive-action/90 focus-visible:ring-destructive-subtle',
|
|
33
33
|
/** A bordered button for a surface that already has a fill. */
|
|
34
34
|
outline:
|
|
35
35
|
'border border-border bg-transparent text-foreground hover:bg-surface-hover hover:border-input',
|
|
@@ -262,7 +262,12 @@ export function DialogContent(props: DialogContentProps) {
|
|
|
262
262
|
<DialogOverlay />
|
|
263
263
|
<div class={overlayPositioner}>
|
|
264
264
|
<KobalteDialog.Content
|
|
265
|
-
class={cn(
|
|
265
|
+
class={cn(
|
|
266
|
+
overlaySurface,
|
|
267
|
+
overlayMotion,
|
|
268
|
+
'relative grid w-full max-w-lg gap-4 p-5',
|
|
269
|
+
local.class
|
|
270
|
+
)}
|
|
266
271
|
{...rest}
|
|
267
272
|
>
|
|
268
273
|
{local.children}
|
package/src/lib/themes.ts
CHANGED
|
@@ -39,6 +39,7 @@ import {
|
|
|
39
39
|
chartSeries,
|
|
40
40
|
getAccent,
|
|
41
41
|
hasTheme,
|
|
42
|
+
shadcnDestructiveProjection,
|
|
42
43
|
statusForeground,
|
|
43
44
|
tint,
|
|
44
45
|
primaryHover,
|
|
@@ -78,6 +79,9 @@ export type ThemeColors = {
|
|
|
78
79
|
destructive: string
|
|
79
80
|
destructiveForeground: string
|
|
80
81
|
destructiveSubtle: string
|
|
82
|
+
/** Contrast-safe solid-action presentation, derived from the canonical error role. */
|
|
83
|
+
destructiveAction: string
|
|
84
|
+
destructiveActionForeground: string
|
|
81
85
|
success: string
|
|
82
86
|
successForeground: string
|
|
83
87
|
successSubtle: string
|
|
@@ -170,10 +174,12 @@ export type ThemeVariant = {
|
|
|
170
174
|
/**
|
|
171
175
|
* Canonical role → this system's `ThemeColors` key.
|
|
172
176
|
*
|
|
173
|
-
* Read by {@link toVariant}.
|
|
174
|
-
*
|
|
177
|
+
* Read by {@link toVariant}. The two derived destructive-action presentation values
|
|
178
|
+
* are intentionally excluded; the shared Themes adapter owns their color math.
|
|
175
179
|
*/
|
|
176
|
-
|
|
180
|
+
type ThemeRole = Exclude<keyof ThemeColors, 'destructiveAction' | 'destructiveActionForeground'>
|
|
181
|
+
|
|
182
|
+
const ROLE_FOR: Readonly<Record<ThemeRole, keyof AdeaThemeRecord['colors']>> = {
|
|
177
183
|
background: 'background',
|
|
178
184
|
foreground: 'text',
|
|
179
185
|
card: 'surface',
|
|
@@ -216,14 +222,17 @@ const ROLE_FOR: Readonly<Record<keyof ThemeColors, keyof AdeaThemeRecord['colors
|
|
|
216
222
|
/** Builds the design system's view of one catalogue entry. */
|
|
217
223
|
function toVariant(theme: AdeaThemeRecord): ThemeVariant {
|
|
218
224
|
const colors = {} as ThemeColors
|
|
219
|
-
for (const key of Object.keys(ROLE_FOR) as
|
|
225
|
+
for (const key of Object.keys(ROLE_FOR) as ThemeRole[]) {
|
|
220
226
|
colors[key] = theme.colors[ROLE_FOR[key]]
|
|
221
227
|
}
|
|
222
|
-
//
|
|
223
|
-
//
|
|
224
|
-
//
|
|
228
|
+
// Keep the semantic foreground paired with the canonical error role. Filled
|
|
229
|
+
// destructive actions use the distinct projection below so their /90 hover state
|
|
230
|
+
// remains readable without changing icons, borders, or tinted status surfaces.
|
|
225
231
|
colors.destructiveForeground = statusForeground(theme, 'error')
|
|
226
232
|
colors.destructiveSubtle = tint(theme.colors.error, theme.colors.background)
|
|
233
|
+
const destructiveAction = shadcnDestructiveProjection(theme)
|
|
234
|
+
colors.destructiveAction = destructiveAction.fill
|
|
235
|
+
colors.destructiveActionForeground = destructiveAction.foreground
|
|
227
236
|
colors.successForeground = statusForeground(theme, 'success')
|
|
228
237
|
colors.successSubtle = tint(theme.colors.success, theme.colors.background)
|
|
229
238
|
colors.warningForeground = statusForeground(theme, 'warning')
|
|
@@ -397,6 +406,8 @@ export function themeCssVariables(theme: ThemeVariant): Record<string, string> {
|
|
|
397
406
|
'--destructive': c.destructive,
|
|
398
407
|
'--destructive-foreground': c.destructiveForeground,
|
|
399
408
|
'--destructive-subtle': c.destructiveSubtle,
|
|
409
|
+
'--destructive-action': c.destructiveAction,
|
|
410
|
+
'--destructive-action-foreground': c.destructiveActionForeground,
|
|
400
411
|
'--success': c.success,
|
|
401
412
|
'--success-foreground': c.successForeground,
|
|
402
413
|
'--success-subtle': c.successSubtle,
|
package/src/lib/tokens.ts
CHANGED
|
@@ -184,13 +184,14 @@ export const colorTokens: TokenDefinition[] = [
|
|
|
184
184
|
name: 'destructive',
|
|
185
185
|
kind: 'color',
|
|
186
186
|
themed: true,
|
|
187
|
-
description: '
|
|
187
|
+
description: 'The canonical error hue for semantic status indicators and tinted notices.',
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
name: 'destructive-foreground',
|
|
191
191
|
kind: 'color',
|
|
192
192
|
themed: true,
|
|
193
|
-
description:
|
|
193
|
+
description:
|
|
194
|
+
'Text on the canonical error hue; solid actions use `destructive-action-foreground`.',
|
|
194
195
|
},
|
|
195
196
|
{
|
|
196
197
|
name: 'destructive-subtle',
|
|
@@ -198,6 +199,18 @@ export const colorTokens: TokenDefinition[] = [
|
|
|
198
199
|
themed: true,
|
|
199
200
|
description: 'Opaque destructive tint against the canvas; subtle labels use foreground.',
|
|
200
201
|
},
|
|
202
|
+
{
|
|
203
|
+
name: 'destructive-action',
|
|
204
|
+
kind: 'color',
|
|
205
|
+
themed: true,
|
|
206
|
+
description: 'Contrast-safe solid fill for destructive actions, derived from the error role.',
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
name: 'destructive-action-foreground',
|
|
210
|
+
kind: 'color',
|
|
211
|
+
themed: true,
|
|
212
|
+
description: 'Text on the destructive action fill and its 90% hover composition.',
|
|
213
|
+
},
|
|
201
214
|
{ name: 'success', kind: 'color', themed: true, description: 'A completed or healthy state.' },
|
|
202
215
|
{ name: 'success-foreground', kind: 'color', themed: true, description: 'Label on `success`.' },
|
|
203
216
|
{
|
package/src/styles/theme.css
CHANGED
|
@@ -81,6 +81,8 @@
|
|
|
81
81
|
/* Status fills; solid labels and subtle surfaces come from the catalogue. */
|
|
82
82
|
--destructive: oklch(0.4705 0.1626 25.78);
|
|
83
83
|
--destructive-foreground: oklch(0.933 0.016 261.79);
|
|
84
|
+
--destructive-action: oklch(0.4705 0.1626 25.78);
|
|
85
|
+
--destructive-action-foreground: oklch(0.933 0.016 261.79);
|
|
84
86
|
--success: oklch(0.4311 0.1809 145.62);
|
|
85
87
|
--success-foreground: oklch(0.933 0.016 261.79);
|
|
86
88
|
--warning: oklch(0.4556 0.1401 79.91);
|
|
@@ -216,6 +218,8 @@
|
|
|
216
218
|
/* Status fills; solid labels and subtle surfaces come from the catalogue. */
|
|
217
219
|
--destructive: oklch(0.7345 0.1626 25.78);
|
|
218
220
|
--destructive-foreground: oklch(0.1918 0.0238 265.37);
|
|
221
|
+
--destructive-action: oklch(0.7345 0.1626 25.78);
|
|
222
|
+
--destructive-action-foreground: oklch(0.1918 0.0238 265.37);
|
|
219
223
|
--success: oklch(0.6951 0.1809 145.62);
|
|
220
224
|
--success-foreground: oklch(0.1918 0.0238 265.37);
|
|
221
225
|
--warning: oklch(0.7196 0.1401 79.91);
|
|
@@ -730,6 +734,8 @@
|
|
|
730
734
|
--color-destructive: var(--destructive);
|
|
731
735
|
--color-destructive-foreground: var(--destructive-foreground);
|
|
732
736
|
--color-destructive-subtle: var(--destructive-subtle);
|
|
737
|
+
--color-destructive-action: var(--destructive-action);
|
|
738
|
+
--color-destructive-action-foreground: var(--destructive-action-foreground);
|
|
733
739
|
--color-success: var(--success);
|
|
734
740
|
--color-success-foreground: var(--success-foreground);
|
|
735
741
|
--color-success-subtle: var(--success-subtle);
|