UNPKG

@assistant-ui/react

Version:

React components for AI chat.

111 lines (110 loc) 5.05 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/tailwindcss/index.ts var tailwindcss_exports = {}; __export(tailwindcss_exports, { default: () => tailwindcss_default }); module.exports = __toCommonJS(tailwindcss_exports); var import_plugin = __toESM(require("tailwindcss/plugin.js")); var import_base_components_css = __toESM(require("../../dist/styles/tailwindcss/base-components.css.json")); var import_thread_css = __toESM(require("../../dist/styles/tailwindcss/thread.css.json")); var import_modal_css = __toESM(require("../../dist/styles/tailwindcss/modal.css.json")); var import_default_css = __toESM(require("../../dist/styles/themes/default.css.json")); var auiPlugin = import_plugin.default.withOptions( ({ components = ["assistant-modal", "thread"], shadcn = false } = {}) => ({ addComponents }) => { const assistantModal = components.includes("assistant-modal"); const thread = assistantModal || components.includes("thread"); const base = thread || components.includes("base"); const defaultTheme = components.includes("default-theme"); if (defaultTheme && shadcn) throw new Error("default-theme cannot be used with shadcn"); if (defaultTheme || base && !shadcn) { addComponents(import_default_css.default); } if (base) { addComponents(import_base_components_css.default); } if (thread) { addComponents(import_thread_css.default); } if (assistantModal) { addComponents(import_modal_css.default); } }, ({ shadcn = false, colors = {} } = {}) => { const prefix = !shadcn ? "--aui-" : "--"; return { safelist: [{ pattern: /aui-/ }], theme: { extend: { colors: { aui: { border: colors.border ?? `hsl(var(${prefix}border))`, input: colors.input ?? `hsl(var(${prefix}input))`, ring: colors.ring ?? `hsl(var(${prefix}ring))`, background: colors.background ?? `hsl(var(${prefix}background))`, foreground: colors.foreground ?? `hsl(var(${prefix}foreground))`, primary: { DEFAULT: colors.primary?.DEFAULT ?? `hsl(var(${prefix}primary))`, foreground: colors.primary?.foreground ?? `hsl(var(${prefix}primary-foreground))` }, secondary: { DEFAULT: colors.secondary?.DEFAULT ?? `hsl(var(${prefix}secondary))`, foreground: colors.secondary?.foreground ?? `hsl(var(${prefix}secondary-foreground))` }, destructive: { DEFAULT: colors.destructive?.DEFAULT ?? `hsl(var(${prefix}destructive))`, foreground: `hsl(var(${prefix}destructive-foreground))` }, muted: { DEFAULT: `hsl(var(${prefix}muted))`, foreground: colors.muted?.foreground ?? `hsl(var(${prefix}muted-foreground))` }, accent: { DEFAULT: colors.accent?.DEFAULT ?? `hsl(var(${prefix}accent))`, foreground: colors.accent?.foreground ?? `hsl(var(${prefix}accent-foreground))` }, popover: { DEFAULT: colors.popover?.DEFAULT ?? `hsl(var(${prefix}popover))`, foreground: colors.popover?.foreground ?? `hsl(var(${prefix}popover-foreground))` }, card: { DEFAULT: colors.card?.DEFAULT ?? `hsl(var(${prefix}card))`, foreground: colors.card?.foreground ?? `hsl(var(${prefix}card-foreground))` } } } } } }; } ); var tailwindcss_default = auiPlugin; //# sourceMappingURL=index.js.map