Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

13.1 KB
Raw Blame
/** @type {import('tailwindcss').Config} */
module.exports = {
  theme: {
    extend: {
      fontFamily: {
        'theme-ui': ['var(--theme-font-family, Inter, sans-serif)'],
        /** A dialog title's family, the display family unless a theme names its own. */
        'theme-dialog-title': [
          'var(--theme-dialog-title-font-family, var(--theme-display-font-family, inherit))',
        ],
      },
      fontWeight: {
        /** A theme-sized control's label weight. */
        'theme-control': 'var(--theme-control-font-weight, 500)',
        /** A dialog title's weight; `-weight` keeps it apart from the family of the same name. */
        'theme-dialog-title-weight': 'var(--theme-dialog-title-font-weight, 600)',
        /** A field label's weight, the weight of the text around it by default. */
        'theme-label': 'var(--theme-label-font-weight, inherit)',
      },
      height: {
        'theme-control': 'var(--theme-control-height, 2.25rem)',
        'theme-switch': 'var(--theme-switch-height, 1.5rem)',
        /** The Button's default and `sm` heights, held at WCAG 2.5.8's 24px target minimum with
         *  `max()` so a stored theme that names less still loads and draws a reachable control. */
        'theme-button': 'max(var(--theme-button-height, 2.5rem), 24px)',
        'theme-button-sm': 'max(var(--theme-button-height-sm, 2.25rem), 24px)',
        'theme-button-xs': 'var(--theme-button-height-xs, 1.75rem)',
        'theme-button-lg': 'var(--theme-button-height-lg, 2.75rem)',
        'theme-button-compact': 'var(--theme-button-height-compact, 2rem)',
        /** A form field's height, and the large `title` field's. */
        'theme-field': 'var(--theme-field-height, 2.5rem)',
        'theme-field-lg': 'var(--theme-field-height-lg, 3rem)',
        /** The sign-in form's floating-label field and submit button. */
        'theme-auth-field': 'var(--theme-auth-field-height, 2.75rem)',
        'theme-auth-button': 'var(--theme-auth-button-height, 3rem)',
        'theme-auth-action': 'var(--theme-auth-action-height, 2.5rem)',
        /** WCAG 2.5.8's 24px target minimum, fixed so a theme can draw controls larger, never
         *  smaller. */
        'theme-target': '24px',
        /** A header cell: the table's vertical cell space on both sides of one text line. */
        'theme-table-head': 'calc(var(--theme-table-cell-space-y, 1rem) * 2 + 1rem)',
        /** A compact header: half the cell space on both sides of a text-sm line. */
        'theme-table-head-compact': 'calc(var(--theme-table-cell-space-y, 1rem) + 1.25rem)',
      },
      minHeight: {
        /** WCAG 2.5.8's 24px target minimum, fixed so a theme can draw controls larger, never
         *  smaller. */
        'theme-target': '24px',
      },
      minWidth: {
        /** WCAG 2.5.8's 24px target minimum, fixed so a theme can draw controls larger, never
         *  smaller. */
        'theme-target': '24px',
        /** The narrowest a tab trigger draws. */
        'theme-tab': 'var(--theme-tab-min-width, 100px)',
        /** The narrowest a field Dropdown's list draws. */
        'theme-list': 'var(--theme-list-min-width, 8rem)',
      },
      maxHeight: {
        /** The tallest a field Dropdown's list draws before it scrolls, never past the room the
         *  popover leaves between its trigger and the viewport's edge. */
        'theme-list':
          'min(var(--theme-list-max-height, 24rem), var(--popover-available-height, 100dvh))',
      },
      inset: {
        /** Where a sign-in label rests in its field: centered 2px low, as on the stock 44px field,
         *  and never past the field's bottom edge at the 24px minimum height. Read on the label, so
         *  `lh` is the label's own line. */
        'theme-auth-label-rest': 'min(calc(50% - 0.5lh + 2px), calc(100% - 1lh))',
      },
      width: {
        /** Never narrower than the track is tall, so the knob always has somewhere to travel. */
        'theme-switch':
          'max(var(--theme-switch-width, 2.75rem), var(--theme-switch-height, 1.5rem))',
      },
      spacing: {
        'theme-compact': 'var(--theme-space-compact, 0.375rem)',
        'theme-normal': 'var(--theme-space-normal, 0.75rem)',
        'theme-control': 'var(--theme-control-height, 2.25rem)',
        /** Square sizes: icon buttons as wide as their row is tall (never under the 24px target
         *  floor, like the height they follow), the checkbox, and icons. */
        'theme-button': 'max(var(--theme-button-height, 2.5rem), 24px)',
        'theme-button-xs': 'var(--theme-button-height-xs, 1.75rem)',
        'theme-icon-button-sm': 'var(--theme-icon-button-size-sm, 2rem)',
        'theme-checkbox': 'var(--theme-checkbox-size, 1rem)',
        'theme-icon': 'var(--theme-icon-size, 1rem)',
        'theme-icon-md': 'var(--theme-icon-size-md, 1.25rem)',
        'theme-icon-lg': 'var(--theme-icon-size-lg, 1.5rem)',
        /** A square control inside the sign-in field, 4px off its edges, never under the 24px
         *  target and never over the stock 2.25rem the field's end padding reserves: the password
         *  field's reveal and copy buttons. */
        'theme-auth-field-action':
          'clamp(24px, calc(var(--theme-auth-field-height, 2.75rem) - 0.5rem), 2.25rem)',
        /** A theme-sized control's inline padding and gap, falling back to the shared spacing it
         *  read before, for a stylesheet that predates the roles. */
        'theme-button-x': 'var(--theme-button-padding-x, 1rem)',
        'theme-control-x': 'var(--theme-control-padding-x, var(--theme-space-normal, 0.75rem))',
        'theme-control-gap': 'var(--theme-control-gap, var(--theme-space-compact, 0.375rem))',
        /** A dialog's inline padding and the gap between its title and description. */
        'theme-dialog-x': 'var(--theme-dialog-padding-x, 1.5rem)',
        /** A form field's vertical padding. */
        'theme-field-y': 'var(--theme-field-padding-y, 0.5rem)',
        'theme-dialog-header': 'var(--theme-dialog-header-gap, 0.375rem)',
        /**
         * The comfortable tap target (2.75rem / 44px), held against the theme's
         * own control height with `max()` so a theme that already draws larger
         * controls is never shrunk on a phone. Pair it
         * with `touch:`.
         */
        'theme-control-touch': 'max(var(--theme-control-height, 2.25rem), 2.75rem)',
        /** The switch knob inside the track's 2px border, in px so it holds at any root size,
         *  and how far it travels when checked (the borders cancel out of the travel). */
        'theme-switch-thumb': 'max(0px, calc(var(--theme-switch-height, 1.5rem) - 4px))',
        'theme-switch-travel':
          'max(0px, calc(var(--theme-switch-width, 2.75rem) - var(--theme-switch-height, 1.5rem)))',
        'theme-table-cell': 'var(--theme-table-cell-space-y, 1rem)',
        /** The compact and dense table sizes: half and a quarter of the cell space. */
        'theme-table-cell-compact': 'calc(var(--theme-table-cell-space-y, 1rem) / 2)',
        'theme-table-cell-dense': 'calc(var(--theme-table-cell-space-y, 1rem) / 4)',
      },
      keyframes: {
        /** Discord-style "connecting" dots: each dot lifts and brightens in
         *  turn, so a stalled request still shows motion. Lives in the preset
         *  because `LoadingDots` ships from this package and the app's own
         *  config extends it. */
        'loading-dot': {
          '0%, 70%, 100%': { opacity: '0.35', transform: 'translateY(0)' },
          '35%': { opacity: '1', transform: 'translateY(-2px)' },
        },
        'accordion-down': {
          from: { height: '0' },
          to: { height: 'var(--radix-accordion-content-height)' },
        },
        'accordion-up': {
          from: { height: 'var(--radix-accordion-content-height)' },
          to: { height: '0' },
        },
        'caret-blink': {
          '0%,70%,100%': { opacity: '1' },
          '20%,50%': { opacity: '0' },
        },
      },
      animation: {
        'loading-dot': 'loading-dot 1.2s ease-in-out var(--loading-dot-delay, 0ms) infinite',
        'accordion-down': 'accordion-down 0.2s ease-out',
        'accordion-up': 'accordion-up 0.2s ease-out',
        'caret-blink': 'caret-blink 1.25s ease-out infinite',
      },
      /**
       * `rounded-sm` through `rounded-3xl` are not restated here: `@librechat/client/theme.css`
       * maps them onto `--theme-radius-*` as `@theme inline`, the same declarations the app
       * compiles, so a consumer's corners are the app's and follow the same theme.
       */
      borderRadius: {
        'theme-control': 'var(--theme-control-radius, 0.75rem)',
        'theme-control-round': 'var(--theme-round-control-radius, 9999px)',
        'theme-surface': 'var(--theme-surface-radius, 1rem)',
        'theme-popover': 'var(--theme-popover-radius, 1rem)',
        'theme-menu-panel': 'var(--theme-menu-panel-radius, 0.75rem)',
        'theme-compact-panel': 'var(--theme-compact-panel-radius, 0.5rem)',
        'theme-composer-action': 'var(--theme-composer-action-radius, 9999px)',
        'theme-auth-control': 'var(--theme-auth-control-radius, 1rem)',
        'theme-auth-action': 'var(--theme-auth-action-radius, 0.5rem)',
        'theme-surface-lg': 'var(--theme-large-surface-radius, 1.5rem)',
        'theme-tab': 'var(--theme-tab-radius, 0.185rem)',
        'theme-checkbox': 'var(--theme-checkbox-radius, calc(0.5rem - 4px))',
      },
      boxShadow: {
        'theme-surface':
          'var(--theme-elevation-surface, 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1))',
      },
      /** The width and offset of the keyboard focus outline, the `focusRingWidth` and `focusRingOffset` roles. */
      outlineWidth: {
        'theme-focus': 'var(--theme-focus-ring-width, 2px)',
      },
      outlineOffset: {
        'theme-focus': 'var(--theme-focus-ring-offset, 2px)',
      },
      transitionDuration: {
        'theme-fast': 'var(--theme-motion-fast, 150ms)',
        'theme-normal': 'var(--theme-motion-normal, 200ms)',
      },
    },
  },
  plugins: [
    /**
     * The published components write `animate-in`, `fade-in-0`, `zoom-in-95` and
     * `slide-in-from-*` (dialogs, popovers, dropdowns), which this plugin owns.
     * It belongs in the preset rather than in the app's config alone: a consumer
     * following the documented setup loads only this file, and without it those
     * classes generate nothing and the surfaces appear without their motion.
     * Declared as a peer dependency so the consumer's install provides it.
     */
    require('tailwindcss-animate'),
    /**
     * A bare function rather than `plugin()` from `tailwindcss/plugin`, because
     * this preset ships as a raw file through the `./tailwind-preset` export and
     * `tailwindcss` is a devDependency here. Requiring it would fail to resolve
     * for an external consumer under pnpm or Yarn PnP. Tailwind accepts a plain
     * function in `plugins`; the wrapper only adds option and config handling
     * this variant does not need.
     */
    ({ addVariant }) => {
      /**
       * Styling that applies only in the high contrast appearance modes, the
       * same way `dark:` applies only under the `dark` class. Distinct from
       * Tailwind's built-in `contrast-more:`, which is the raw
       * `prefers-contrast: more` media query: this follows the resolved app
       * mode, so it covers an explicit `high-contrast-light` /
       * `high-contrast-dark` choice as well as the OS preference.
       */
      addVariant('high-contrast', 'html.high-contrast &');

      /**
       * Touch is reachable at all — `any-pointer`, deliberately not `pointer`.
       * `pointer` describes only the PRIMARY pointing device, so a 2-in-1 driven
       * by its trackpad reports `fine` with its touchscreen right there, and a
       * tap-target floor written against `(pointer: coarse)` would never reach
       * the finger it exists for.
       *
       * Not the query `useFocusChatEffect` and the composer's focus guard branch
       * on, though it looks like it: those ask "would focusing raise an on-screen
       * keyboard over the thread", which is a question about the primary input and
       * must keep answering `fine` for the trackpad user on that same 2-in-1. A
       * tap target asks the other question — whether a finger can reach the
       * control at all — so the two queries differ on purpose.
       */
      addVariant('touch', '@media (any-pointer: coarse)');

      /**
       * For hiding something until hover. Hover-gating alone strands the finger
       * user of a 2-in-1, because `(hover: hover)` is true there (it describes
       * the trackpad) while the touchscreen sits right next to it, so the hidden
       * state also needs the absence of any coarse pointer. The absence alone is
       * not enough either: it matches a pointerless or print context, where no
       * hover can ever reveal the control again, so both conditions nest.
       *
       * `not all and`, not the Media Queries Level 4 `not (...)`, because
       * lightningcss lowers this for the production build's browser targets.
       */
      addVariant('no-touch', {
        '@media (hover: hover)': { '@media not all and (any-pointer: coarse)': '@slot' },
      });
    },
  ],
};