/*! * * Copyright (c) "Neo4j" * Neo4j Sweden AB [http://neo4j.com] * * This file is part of Neo4j. * * Neo4j is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * Builds the safelist that keeps every semantic color utility * (`text-*`, `bg-*`, `border-*` and their `hover:`/`active:` variants) * in the generated CSS, regardless of whether a scanned source file uses it. * * The safelist is only needed when you build color class names dynamically * (for example `` `bg-${color}` ``), which Tailwind can't find by scanning. * Needle's own components ship prebuilt CSS and don't depend on it. * * The patterns are matched against the final class name, so they need to * include whatever `prefix` the consuming Tailwind config sets. The preset * ships without a prefix; pass your own prefix if you override it: * * ```js * const { tailwindConfig, createTailwindSafelist } = require('@neo4j-ndl/base'); * module.exports = { * presets: [tailwindConfig], * prefix: 'tw-', * safelist: createTailwindSafelist('tw-'), * }; * ``` * * @param {string} [prefix=''] - The Tailwind `prefix` option in use. * @returns {import('tailwindcss').Config['safelist']} */ export function createTailwindSafelist(prefix?: string): import("tailwindcss").Config["safelist"]; /** * The Tailwind CSS v4 counterpart of `createTailwindSafelist()`. Tailwind v4 * has no `safelist` option, so this returns `@source inline()` rules that keep * the same semantic color utilities (`bg-*` with `hover:`/`active:`, `text-*` * and `border-*` with `hover:`) in your CSS. * * `@neo4j-ndl/base/lib/tailwind/safelist.css` is this output without a * prefix. If you import Tailwind with `prefix(...)`, write the output for your * prefix to a CSS file at build time and import that instead: * * ```js * // scripts/needle-safelist.mjs, run before your build * import { writeFileSync } from 'node:fs'; * import { createTailwindV4Safelist } from '@neo4j-ndl/base'; * writeFileSync('src/needle-safelist.css', createTailwindV4Safelist('tw')); * ``` * * ```css * @import 'tailwindcss/theme.css' layer(theme) prefix(tw); * ... * @import './needle-safelist.css'; * ``` * * @param {string} [prefix=''] - The name passed to Tailwind's `prefix()`, for * example `tw` for `prefix(tw)`. Tailwind v4 only accepts lowercase letters. * @returns {string} One `@source inline()` rule per line. */ export function createTailwindV4Safelist(prefix?: string): string; /** * Tailwind CSS Configuration * containing all configurations we need * for our components * * The preset does not set a `prefix`, so utilities are generated with * their plain Tailwind names (`flex`, `text-neutral-text-weak`, ...). * Consumers who still want a prefix can set `prefix` in their own config * and pair it with `createTailwindSafelist(prefix)`. * * The preset does not set `content` either: which files to scan depends on * the consuming app, so set it in your own config. */ /** @type {Omit} */ export const tailwindConfig: Omit; //# sourceMappingURL=tailwind-preset.config.d.ts.map